Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
146ed89
Revert "FROMLIST: PCI/MSI: Check MSI_FLAG_PCI_MSI_MASK_PARENT in cond…
RevySR Oct 10, 2025
a6c3687
Revert "FROMLIST: riscv: errata: Add ERRATA_THEAD_WRITE_ONCE fixup"
RevySR Oct 10, 2025
aa3cc33
Revert "FROMLIST: riscv: Move vendor errata definitions to new header"
RevySR Oct 10, 2025
315b016
Revert "FROMLIST: irqchip/sg2042-msi: Set MSI_FLAG_MULTI_PCI_MSI flag…
RevySR Oct 10, 2025
0e936ba
Revert "FROMLIST: irqchip/sg2042-msi: Fix broken affinity setting"
RevySR Oct 10, 2025
6f10a57
Revert "FROMLIST: PCI/MSI: Add startup/shutdown for per device domains"
RevySR Oct 10, 2025
b66db21
Revert "FROMLIST: genirq: Add irq_chip_(startup/shutdown)_parent()"
RevySR Oct 10, 2025
839c3d8
Revert "FROMLIST: irqchip/sifive-plic: Respect mask state when settin…
RevySR Oct 10, 2025
0e12580
Revert "FROMLIST: riscv: introduce ioremap_wc()"
RevySR Oct 10, 2025
e9f6c03
Revert "FROMLIST: riscv: mmap(): use unsigned offset type in riscv_sy…
RevySR Oct 10, 2025
6c0062e
Revert "FROMLIST: PCI: sg2042: Add Sophgo SG2042 PCIe driver"
RevySR Oct 10, 2025
affbe6a
Revert "FROMLIST: PCI: cadence: Check pcie-ops before using it"
RevySR Oct 10, 2025
c86037a
Revert "FROMLIST: dt-bindings: pci: Add Sophgo SG2042 PCIe host"
RevySR Oct 10, 2025
542c906
Revert "FROMLIST: dts: sophgo: sg2042: added numa id description"
RevySR Oct 10, 2025
1bffa00
UPSTREAM: riscv: mmap(): use unsigned offset type in riscv_sys_mmap
Aug 1, 2025
c85dfb2
UPSTREAM: riscv: introduce ioremap_wc()
cuiyunhui Jul 22, 2025
659bb39
UPSTREAM: irqchip/sifive-plic: Respect mask state when setting affinity
inochisa Aug 11, 2025
896da84
UPSTREAM: genirq: Add irq_chip_(startup/shutdown)_parent()
inochisa Aug 13, 2025
ce12d82
UPSTREAM: PCI/MSI: Add startup/shutdown for per device domains
inochisa Aug 13, 2025
8b12d1b
UPSTREAM: irqchip/sg2042-msi: Fix broken affinity setting
inochisa Aug 13, 2025
f8448fb
UPSTREAM: irqchip/sg2042-msi: Set MSI_FLAG_MULTI_PCI_MSI flags for SG…
inochisa Aug 13, 2025
35a3900
UPSTREAM: PCI/MSI: Check MSI_FLAG_PCI_MSI_MASK_PARENT in cond_[startu…
inochisa Aug 27, 2025
373fc8d
UPSTREAM: riscv: Move vendor errata definitions to new header
guoren83 Jul 13, 2025
db4ef7f
UPSTREAM: dts: sophgo: sg2042: added numa id description
RevySR Sep 10, 2025
f8d3da2
UPSTREAM: dt-bindings: pci: Add Sophgo SG2042 PCIe host
unicornx Sep 12, 2025
4c28c2e
UPSTREAM: PCI: cadence: Check for the existence of cdns_pcie::ops bef…
unicornx Sep 12, 2025
fc7ca56
UPSTREAM: PCI: sg2042: Add Sophgo SG2042 PCIe driver
unicornx Sep 12, 2025
49d801c
UPSTREAM: riscv: mm: Return intended SATP mode for noXlvl options
pigmoral Jul 21, 2025
e586c9f
UPSTREAM: riscv: mm: Use mmu-type from FDT to limit SATP mode
pigmoral Jul 21, 2025
8e93611
FROMLIST: riscv: errata: Add ERRATA_THEAD_WRITE_ONCE fixup
guoren83 Jul 13, 2025
a840160
FROMLIST: riscv: Add pgprot_dmacoherent definition
guoren83 Oct 11, 2025
5dc16a1
FROMLIST: PCI: Release BAR0 of an integrated bridge to allow GPU BAR …
ij-intel Sep 18, 2025
8b0b065
UPSTREAM: irqchip/sg2042-msi: Set irq type according to DT configuration
unicornx Sep 4, 2025
598227c
UPSTREAM: riscv: sophgo: dts: sg2042: Change msi irq type to IRQ_TYPE…
unicornx Sep 4, 2025
f9da96a
UPSTREAM: riscv: sophgo: dts: sg2044: Change msi irq type to IRQ_TYPE…
unicornx Sep 4, 2025
d1cff7d
FROMLIST: perf vendor events riscv: add T-HEAD C920V2 JSON support
inochisa Oct 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arch/riscv/boot/dts/sophgo/sg2042.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
reg-names = "clr", "doorbell";
msi-controller;
#msi-cells = <0>;
msi-ranges = <&intc 64 IRQ_TYPE_LEVEL_HIGH 32>;
msi-ranges = <&intc 64 IRQ_TYPE_EDGE_RISING 32>;
};

rpgate: clock-controller@7030010368 {
Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/boot/dts/sophgo/sg2044.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
reg-names = "clr", "doorbell";
#msi-cells = <0>;
msi-controller;
msi-ranges = <&intc 352 IRQ_TYPE_LEVEL_HIGH 512>;
msi-ranges = <&intc 352 IRQ_TYPE_EDGE_RISING 512>;
status = "disabled";
};

Expand Down
6 changes: 3 additions & 3 deletions arch/riscv/include/asm/errata_list_vendors.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#define ASM_ERRATA_LIST_VENDORS_H

#ifdef CONFIG_ERRATA_ANDES
#define ERRATA_ANDES_NO_IOCP 0
#define ERRATA_ANDES_NUMBER 1
#define ERRATA_ANDES_NO_IOCP 0
#define ERRATA_ANDES_NUMBER 1
#endif

#ifdef CONFIG_ERRATA_SIFIVE
Expand All @@ -22,4 +22,4 @@
#define ERRATA_THEAD_NUMBER 4
#endif

#endif
#endif /* ASM_ERRATA_LIST_VENDORS_H */
9 changes: 9 additions & 0 deletions arch/riscv/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,15 @@ static inline pgprot_t pgprot_writecombine(pgprot_t _prot)
return __pgprot(prot);
}

/*
* DMA allocations for non-coherent devices use what the RISC-V architecture
* call "Non-Cacheable" memory attribute, which permits idempotent, weakly-ordered
* (RVWMO), main memory. This is different from "I/O" memory attribute which is
* intended for MMIO access with Non-cacheable, non-idempotent, strongly-ordered
* (I/O ordering), I/O attributes.
*/
#define pgprot_dmacoherent pgprot_writecombine

/*
* Both Svade and Svadu control the hardware behavior when the PTE A/D bits need to be set. By
* default the M-mode firmware enables the hardware updating scheme when only Svadu is present in
Expand Down
4 changes: 2 additions & 2 deletions arch/riscv/kernel/pi/cmdline_early.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ static char *get_early_cmdline(uintptr_t dtb_pa)
static u64 match_noXlvl(char *cmdline)
{
if (strstr(cmdline, "no4lvl"))
return SATP_MODE_48;
return SATP_MODE_39;
else if (strstr(cmdline, "no5lvl"))
return SATP_MODE_57;
return SATP_MODE_48;

return 0;
}
Expand Down
40 changes: 40 additions & 0 deletions arch/riscv/kernel/pi/fdt_early.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <linux/init.h>
#include <linux/libfdt.h>
#include <linux/ctype.h>
#include <asm/csr.h>

#include "pi.h"

Expand Down Expand Up @@ -183,3 +184,42 @@ bool fdt_early_match_extension_isa(const void *fdt, const char *ext_name)

return ret;
}

/**
* set_satp_mode_from_fdt - determine SATP mode based on the MMU type in fdt
*
* @dtb_pa: physical address of the device tree blob
*
* Returns the SATP mode corresponding to the MMU type of the first enabled CPU,
* 0 otherwise
*/
u64 set_satp_mode_from_fdt(uintptr_t dtb_pa)
{
const void *fdt = (const void *)dtb_pa;
const char *mmu_type;
int node, parent;

parent = fdt_path_offset(fdt, "/cpus");
if (parent < 0)
return 0;

fdt_for_each_subnode(node, fdt, parent) {
if (!fdt_node_name_eq(fdt, node, "cpu"))
continue;

if (!fdt_device_is_available(fdt, node))
continue;

mmu_type = fdt_getprop(fdt, node, "mmu-type", NULL);
if (!mmu_type)
break;

if (!strcmp(mmu_type, "riscv,sv39"))
return SATP_MODE_39;
else if (!strcmp(mmu_type, "riscv,sv48"))
return SATP_MODE_48;
break;
}

return 0;
}
1 change: 1 addition & 0 deletions arch/riscv/kernel/pi/pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ u64 get_kaslr_seed(uintptr_t dtb_pa);
u64 get_kaslr_seed_zkr(const uintptr_t dtb_pa);
bool set_nokaslr_from_cmdline(uintptr_t dtb_pa);
u64 set_satp_mode_from_cmdline(uintptr_t dtb_pa);
u64 set_satp_mode_from_fdt(uintptr_t dtb_pa);

bool fdt_early_match_extension_isa(const void *fdt, const char *ext_name);

Expand Down
11 changes: 8 additions & 3 deletions arch/riscv/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,7 @@ static __meminit pgprot_t pgprot_from_va(uintptr_t va)

#if defined(CONFIG_64BIT) && !defined(CONFIG_XIP_KERNEL)
u64 __pi_set_satp_mode_from_cmdline(uintptr_t dtb_pa);
u64 __pi_set_satp_mode_from_fdt(uintptr_t dtb_pa);

static void __init disable_pgtable_l5(void)
{
Expand Down Expand Up @@ -855,18 +856,22 @@ static void __init set_mmap_rnd_bits_max(void)
* underlying hardware: establish 1:1 mapping in 4-level page table mode
* then read SATP to see if the configuration was taken into account
* meaning sv48 is supported.
* The maximum SATP mode is limited by both the command line and the "mmu-type"
* property in the device tree, since some platforms may hang if an unsupported
* SATP mode is attempted.
*/
static __init void set_satp_mode(uintptr_t dtb_pa)
{
u64 identity_satp, hw_satp;
uintptr_t set_satp_mode_pmd = ((unsigned long)set_satp_mode) & PMD_MASK;
u64 satp_mode_cmdline = __pi_set_satp_mode_from_cmdline(dtb_pa);
u64 satp_mode_limit = min_not_zero(__pi_set_satp_mode_from_cmdline(dtb_pa),
__pi_set_satp_mode_from_fdt(dtb_pa));

kernel_map.page_offset = PAGE_OFFSET_L5;

if (satp_mode_cmdline == SATP_MODE_57) {
if (satp_mode_limit == SATP_MODE_48) {
disable_pgtable_l5();
} else if (satp_mode_cmdline == SATP_MODE_48) {
} else if (satp_mode_limit == SATP_MODE_39) {
disable_pgtable_l5();
disable_pgtable_l4();
return;
Expand Down
7 changes: 5 additions & 2 deletions drivers/irqchip/irq-sg2042-msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct sg204x_msi_chip_info {
* @doorbell_addr: see TRM, 10.1.32, GP_INTR0_SET
* @irq_first: First vectors number that MSIs starts
* @num_irqs: Number of vectors for MSIs
* @irq_type: IRQ type for MSIs
* @msi_map: mapping for allocated MSI vectors.
* @msi_map_lock: Lock for msi_map
* @chip_info: chip specific infomations
Expand All @@ -41,6 +42,7 @@ struct sg204x_msi_chipdata {

u32 irq_first;
u32 num_irqs;
unsigned int irq_type;

unsigned long *msi_map;
struct mutex msi_map_lock;
Expand Down Expand Up @@ -137,14 +139,14 @@ static int sg204x_msi_parent_domain_alloc(struct irq_domain *domain, unsigned in
fwspec.fwnode = domain->parent->fwnode;
fwspec.param_count = 2;
fwspec.param[0] = data->irq_first + hwirq;
fwspec.param[1] = IRQ_TYPE_EDGE_RISING;
fwspec.param[1] = data->irq_type;

ret = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
if (ret)
return ret;

d = irq_domain_get_irq_data(domain->parent, virq);
return d->chip->irq_set_type(d, IRQ_TYPE_EDGE_RISING);
return d->chip->irq_set_type(d, data->irq_type);
}

static int sg204x_msi_middle_domain_alloc(struct irq_domain *domain, unsigned int virq,
Expand Down Expand Up @@ -298,6 +300,7 @@ static int sg2042_msi_probe(struct platform_device *pdev)
}

data->irq_first = (u32)args.args[0];
data->irq_type = (unsigned int)args.args[1];
data->num_irqs = (u32)args.args[args.nargs - 1];

mutex_init(&data->msi_map_lock);
Expand Down
12 changes: 4 additions & 8 deletions drivers/pci/controller/cadence/pcie-sg2042.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ static int sg2042_pcie_probe(struct platform_device *pdev)
int ret;

bridge = devm_pci_alloc_host_bridge(dev, sizeof(*rc));
if (!bridge) {
dev_err_probe(dev, -ENOMEM, "Failed to alloc host bridge!\n");
return -ENOMEM;
}
if (!bridge)
return dev_err_probe(dev, -ENOMEM, "Failed to alloc host bridge!\n");

bridge->ops = &sg2042_pcie_root_ops;
bridge->child_ops = &sg2042_pcie_child_ops;
Expand All @@ -60,10 +58,8 @@ static int sg2042_pcie_probe(struct platform_device *pdev)
devm_pm_runtime_enable(dev);

ret = cdns_pcie_init_phy(dev, pcie);
if (ret) {
dev_err_probe(dev, ret, "Failed to init phy!\n");
return ret;
}
if (ret)
return dev_err_probe(dev, ret, "Failed to init phy!\n");

ret = cdns_pcie_host_setup(rc);
if (ret) {
Expand Down
23 changes: 23 additions & 0 deletions drivers/pci/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -6432,3 +6432,26 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x461f, quirk_no_shutdown); // Thu
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x462f, quirk_no_shutdown); // Thunderbolt 4 PCI Express Root Port
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x466d, quirk_no_shutdown); // Thunderbolt 4 NHI
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x46a8, quirk_no_shutdown); // GPU

/*
* PCI switches integrated into Intel Arc GPUs have BAR0 that prevents
* resizing the BARs of the GPU device due to that bridge BAR0 pinning the
* bridge window it's under in place. Nothing in pcieport requires that
* BAR0.
*
* Release and disable BAR0 permanently by clearing its flags to prevent
* anything from assigning it again.
*/
static void pci_release_bar0(struct pci_dev *pdev)
{
struct resource *res = pci_resource_n(pdev, 0);

if (!res->parent)
return;

pci_release_resource(pdev, 0);
res->flags = 0;
}
DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_INTEL, 0x4fa0, pci_release_bar0);
DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_INTEL, 0x4fa1, pci_release_bar0);
DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_INTEL, 0xe2ff, pci_release_bar0);
1 change: 1 addition & 0 deletions tools/perf/pmu-events/arch/riscv/mapfile.csv
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
0x489-0x8000000000000008-0x[[:xdigit:]]+,v1,sifive/p550,core
0x489-0x8000000000000[1-6]08-0x[9b][[:xdigit:]]+,v1,sifive/p650,core
0x5b7-0x0-0x0,v1,thead/c900-legacy,core
0x5b7-0x80000000090c0d00-0x2047000,v1,thead/c900-legacy,core
0x67e-0x80000000db0000[89]0-0x[[:xdigit:]]+,v1,starfive/dubhe-80,core
0x31e-0x8000000000008a45-0x[[:xdigit:]]+,v1,andes/ax45,core