-
Notifications
You must be signed in to change notification settings - Fork 105
Support MilkV Titan and Backport PCIe, PLIC driver #1388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support MilkV Titan and Backport PCIe, PLIC driver #1388
Conversation
Use dev_info(), dev_warn(), and dev_err() in-place of pr_info(), pr_warn(), and pr_err(). Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jia Wang <[email protected]>
Use devm_xyz() for allocations and mappings managed by the Linux device driver framework. Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jia Wang <[email protected]>
The RISC-V INTC irqdomain is always the parent irqdomain of SiFive PLIC so use riscv_get_intc_hwnode() to get the parent fwnode similar to other RISC-V drivers which use local interrupts. Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jia Wang <[email protected]>
…ilure The SiFive PLIC contexts should not be left dangling if irqdomain creation fails because plic_starting_cpu() can crash accessing unmapped registers. Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jia Wang <[email protected]>
… plic_probe() The SiFive PLIC driver needs to know the number of interrupts and contexts to complete initialization. Parse these details early in plic_probe() to avoid unnecessary memory allocations and register mappings if these details are not available. Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jia Wang <[email protected]>
Now that PLIC driver is probed as a regular platform driver, the lock
dependency validator complains about the safety of handler->enable_lock
usage:
[ 0.956775] Possible interrupt unsafe locking scenario:
[ 0.956998] CPU0 CPU1
[ 0.957247] ---- ----
[ 0.957439] lock(&handler->enable_lock);
[ 0.957607] local_irq_disable();
[ 0.957793] lock(&irq_desc_lock_class);
[ 0.958021] lock(&handler->enable_lock);
[ 0.958246] <Interrupt>
[ 0.958342] lock(&irq_desc_lock_class);
[ 0.958501]
*** DEADLOCK ***
To address above, use raw_spin_lock_irqsave/unlock_irqrestore() instead
of raw_spin_lock/unlock().
Signed-off-by: Anup Patel <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jia Wang <[email protected]>
The RISC-V advanced interrupt architecture (AIA) extends the per-HART local interrupts in following ways: 1. Minimum 64 local interrupts for both RV32 and RV64 2. Ability to process multiple pending local interrupts in same interrupt handler 3. Priority configuration for each local interrupts 4. Special CSRs to configure/access the per-HART MSI controller Add support for deepin-community#1 and deepin-community#2 described above in the RISC-V intc driver. Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jia Wang <[email protected]>
A future user of the matrix allocator, does not know the size of the matrix bitmaps at compile time. To avoid wasting memory on unnecessary large bitmaps, size the bitmap at matrix allocation time. Signed-off-by: Björn Töpel <[email protected]> Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jia Wang <[email protected]>
Now that the PLIC uses a platform driver, the driver is probed later in the boot process, where interrupts from peripherals might already be pending. As a result, plic_handle_irq() may be called as early as the call to irq_set_chained_handler() completes. But this call happens before the per-context handler is completely set up, so there is a window where plic_handle_irq() can see incomplete per-context state and crash. Avoid this by delaying the call to irq_set_chained_handler() until all handlers from all PLICs are initialized. Fixes: 8ec99b0 ("irqchip/sifive-plic: Convert PLIC driver into a platform driver") Reported-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Anup Patel <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Closes: https://lore.kernel.org/r/CAMuHMdVYFFR7K5SbHBLY-JHhb7YpgGMS_hnRWm8H0KD-wBo+4A@mail.gmail.com/ Signed-off-by: Jia Wang <[email protected]>
The latest Linux RISC-V no longer boots on the Allwinner D1 platform because the sun4i_timer driver fails to get an interrupt from PLIC due to the recent conversion of the PLIC to a platform driver. Converting the sun4i timer to a platform driver does not work either because the D1 does not have a SBI timer available so early boot hangs. See the 'Closes:' link for deeper analysis. The real fix requires enabling the SBI time extension in the platform firmware (OpenSBI) and convert sun4i_timer into platform driver. Unfortunately, the real fix involves changing multiple places and can't be achieved in a short duration and aside of that requires users to update firmware. As a work-around, retrofit PLIC probing such that the PLIC is probed early only for the Allwinner D1 platform and probed as a regular platform driver for rest of the RISC-V platforms. In the process, partially revert some of the previous changes because the PLIC device pointer is not available in all probing paths. Fixes: e306a89 ("irqchip/sifive-plic: Chain to parent IRQ after handlers are ready") Fixes: 8ec99b0 ("irqchip/sifive-plic: Convert PLIC driver into a platform driver") Suggested-by: Thomas Gleixner <[email protected]> Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Samuel Holland <[email protected]> Tested-by: Emil Renner Berthing <[email protected]> Tested-by: Charlie Jenkins <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Reviewed-by: Charlie Jenkins <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/all/[email protected] Closes: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Jia Wang <[email protected]>
Signed-off-by: Jia Wang <[email protected]>
Signed-off-by: Jia Wang <[email protected]>
Signed-off-by: Jia Wang <[email protected]>
community inclusion category: feature bugzilla: RVCK-Project/rvck#71 ------------------------------------------------- Add PLIC early init supports and remove invalid timer nodes in dp1000.dts. Signed-off-by: Jia Wang <[email protected]>
community inclusion category: feature bugzilla: RVCK-Project/rvck#71 -------------------------------- Add suspend and resume callbacks to the ultrarisc PCIe driver to support system power management. During suspend, save the current MSI interrupt mask state from the hardware registers to driver private data. During resume, restore the saved interrupt mask state back to the hardware registers. This ensures MSI interrupt configuration is preserved across suspend/resume cycles. Signed-off-by: Xincheng Zhang <[email protected]> Signed-off-by: Jia Wang <[email protected]>
community inclusion category: feature bugzilla: RVCK-Project/rvck#71 -------------------------------- This commit moves the chosen node configuration from the common dp1000.dts file to the respective board-specific DTS files. This change allows each board to specify its own console configuration while keeping the common SoC definitions clean. Signed-off-by: Jia Wang <[email protected]>
community inclusion category: feature bugzilla: RVCK-Project/rvck#71 -------------------------------- Add gpio-ranges property to all gpio/portX nodes. This property maps GPIO lines to pin controller pins, ensuring proper GPIO pin allocation and management. Convert dp1000.dts to a common include file (dp1000.dtsi) and update the board-specific DTS files to include it. This refactoring allows for better code reuse across different DP1000-based boards (EVB, MO, and Titan variants) while maintaining board-specific configurations. The changes include: - Renaming dp1000.dts to dp1000.dtsi - Updating board-specific DTS files to include the common .dtsi - Adjusting Makefile to reflect these changes - Updating pinctrl files for all board variants Signed-off-by: Jia Wang <[email protected]>
community inclusion category: feature bugzilla: RVCK-Project/rvck#71 -------------------------------- Update ur_pin_config_set() to use the new configuration handling logic. This allows the driver to properly handle standard Linux kernel pin configuration parameters such as PIN_CONFIG_BIAS_PULL_UP, PIN_CONFIG_BIAS_PULL_DOWN, etc. Signed-off-by: Jia Wang <[email protected]>
…aRISC DP1000 SoC community inclusion category: feature bugzilla: RVCK-Project/rvck#71 -------------------------------- Add dp1000-titan-v1.dts and dp1000-titan-pinctrl.dtsi for the Milk-V Titan board. The Titan board is designed by Milk-V and is based on the UltraRISC DP1000 SoC. These device tree files provide the initial support for the board, including pinctrl and basic peripheral configuration. Signed-off-by: Jia Wang <[email protected]>
This reverts commit 6e284d9. Backport the implementation from upstrem mainline. Signed-off-by: Jia Wang <[email protected]>
Reviewer's GuideBackports and extends the RISC‑V interrupt and PCIe stack to support early PLIC init and MilkV Titan/UltraRISC DP1000 platforms, reworking irq matrix allocation, disabling MSI affinity steering for several host controllers, enhancing the UltraRISC pinctrl driver and DT bindings, and wiring up new DTS variants for the Titan board. Sequence diagram for RISC‑V external interrupt handling via intc and PLICsequenceDiagram
participant CPU
participant riscv_intc as riscv_intc_irq
participant riscv_intc_aia as riscv_intc_aia_irq
participant intc_domain
participant PLIC as plic_handle_irq
participant plic_domain
rect rgb(235,235,255)
CPU->>riscv_intc: external interrupt entry
alt AIA available (SxAIA)
riscv_intc->>riscv_intc_aia: call when topi support present
loop while CSR_TOPI nonzero
riscv_intc_aia->>intc_domain: generic_handle_domain_irq(topi >> TOPI_IID_SHIFT)
end
else legacy
riscv_intc->>intc_domain: generic_handle_domain_irq(cause)
end
end
rect rgb(235,255,235)
intc_domain->>PLIC: PLIC parent irq raised (RV_IRQ_EXT)
activate PLIC
PLIC->>PLIC: plic_get_hwirq() in loop
loop while hwirq != 0
PLIC->>plic_domain: generic_handle_domain_irq(hwirq)
alt mapping not found
PLIC->>PLIC: pr_warn_ratelimited(fwnode, hwirq)
end
end
deactivate PLIC
end
Sequence diagram for UltraRISC PCIe MSI mask save/restore on suspend/resumesequenceDiagram
participant PM as PM_core
participant pdev as platform_device
participant upcie as ultrarisc_pcie
participant dw as dw_pcie
participant pp as dw_pcie_rp
rect rgb(235,235,255)
PM->>pdev: suspend callback
pdev->>upcie: ultrarisc_pcie_suspend(state)
upcie->>dw: get pci = ultrarisc_pcie->pci
dw->>pp: get pp = &pci->pp
upcie->>pp: num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL
upcie->>pp: raw_spin_lock_irqsave(pp->lock)
loop for each ctrl
upcie->>upcie: irq_mask[ctrl] = pp->irq_mask[ctrl]
end
upcie->>pp: raw_spin_unlock_irqrestore(pp->lock)
upcie-->>pdev: return 0
end
rect rgb(235,255,235)
PM->>pdev: resume callback
pdev->>upcie: ultrarisc_pcie_resume()
upcie->>dw: get pci = ultrarisc_pcie->pci
dw->>pp: get pp = &pci->pp
upcie->>pp: num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL
upcie->>pp: raw_spin_lock_irqsave(pp->lock)
loop for each ctrl
upcie->>pp: pp->irq_mask[ctrl] = ultrarisc_pcie->irq_mask[ctrl]
upcie->>dw: dw_pcie_writel_dbi(pci, PCIE_MSI_INTR0_MASK + ctrl * MSI_REG_CTRL_BLOCK_SIZE, pp->irq_mask[ctrl])
end
upcie->>pp: raw_spin_unlock_irqrestore(pp->lock)
upcie-->>pdev: return 0
end
Class diagram for updated RISC‑V PLIC driver structures and probe flowclassDiagram
class plic_priv {
+struct fwnode_handle *fwnode
+struct cpumask lmask
+struct irq_domain *irqdomain
+void __iomem *regs
+unsigned long plic_quirks
+u32 nr_irqs
+unsigned long *prio_save
}
class plic_handler {
+bool present
+void __iomem *hart_base
+void __iomem *enable_base
+u32 *enable_save
+raw_spinlock_t enable_lock
+struct plic_priv *priv
}
class plic_probe {
+int plic_probe(struct fwnode_handle *fwnode)
+int plic_platform_probe(struct platform_device *pdev)
+int plic_early_probe(struct device_node *node, struct device_node *parent)
}
class plic_helpers {
+int plic_parse_nr_irqs_and_contexts(struct fwnode_handle *fwnode, u32 *nr_irqs, u32 *nr_contexts)
+int plic_parse_context_parent(struct fwnode_handle *fwnode, u32 context, u32 *parent_hwirq, int *parent_cpu)
+void plic_toggle(struct plic_handler *handler, int hwirq, int enable)
+int plic_irq_suspend(void)
+void plic_irq_resume(void)
}
class plic_global_state {
+int plic_parent_irq
+bool plic_global_setup_done
+struct plic_handler plic_handlers_per_cpu
}
class irqchip_registration {
+struct platform_driver plic_driver
+IRQCHIP_DECLARE(riscv, allwinner_sun20i_d1_plic, plic_early_probe)
+IRQCHIP_DECLARE(ultrarisc_dp1000_plic, ultrarisc_dp1000_plic, plic_early_probe)
}
plic_handler --> plic_priv : priv
plic_global_state --> plic_handler : manages per_cpu
plic_probe --> plic_priv : allocates/initializes
plic_probe --> plic_handler : initializes per_cpu handlers
plic_probe --> plic_helpers : uses
plic_helpers --> plic_priv : reads nr_irqs, regs
plic_helpers --> plic_handler : toggles enable bits
plic_global_state --> irqchip_registration : uses parent_irq mapping
irqchip_registration --> plic_probe : calls from probe/early_probe
Class diagram for irq_matrix and cpumap reworkclassDiagram
class cpumap {
+unsigned int available
+unsigned int allocated
+unsigned int managed
+unsigned int managed_allocated
+bool initialized
+bool online
+unsigned long *managed_map
+unsigned long alloc_map[]
}
class irq_matrix {
+raw_spinlock_t lock
+unsigned int alloc_start
+unsigned int alloc_end
+unsigned int alloc_size
+unsigned int matrix_bits
+unsigned int total_allocated
+unsigned int online_maps
+struct cpumap __percpu *maps
+unsigned long *system_map
+unsigned long scratch_map[]
+struct irq_matrix *irq_alloc_matrix(unsigned int matrix_bits, unsigned int alloc_start, unsigned int alloc_end)
}
irq_matrix --> cpumap : maps~per_cpu~
Class diagram for UltraRISC DP1000 pinctrl structures and helpersclassDiagram
class ur_port_desc {
+const char *name
+u32 npins
+u32 mux_offset
+u32 conf_offset
}
class ur_pinctrl_match_data {
+const struct pinctrl_pin_desc *pins
+u32 npins
+u32 offset
+u32 num_ports
+struct ur_port_desc ports[]
}
class ur_pin_val {
+u32 port
+u32 pin
+u32 conf
}
class ur_pinctrl {
+struct device *dev
+void __iomem *base
+struct pinctrl_desc *pctl_desc
+struct pinctrl_dev *pctl_dev
+const struct ur_pinctrl_match_data *match_data
+raw_spinlock_t lock
+struct mutex mutex
}
class ur_pinctrl_helpers {
+int ur_pin_num_to_port_pin(const struct ur_pinctrl_match_data *match_data, struct ur_pin_val *pin_val, u32 pin_num)
+int ur_config_to_pin_val(struct ur_pinctrl *pin_ctrl, struct ur_pin_val *pin_vals, unsigned long *config)
+int ur_set_pin_conf(struct ur_pinctrl *pin_ctrl, struct ur_pin_val *pin_vals)
+int ur_pin_config_set(struct pinctrl_dev *pctldev, unsigned int pin, unsigned long *configs, unsigned int num_configs)
+int ur_pin_config_get(struct pinctrl_dev *pctldev, unsigned int pin, unsigned long *config)
+int ur_pin_config_group_get(struct pinctrl_dev *pctldev, unsigned int selector, unsigned long *config)
}
ur_pinctrl --> ur_pinctrl_match_data : match_data
ur_pinctrl_match_data --> ur_port_desc : ports
ur_pinctrl_helpers --> ur_pinctrl : operates_on
ur_pinctrl_helpers --> ur_pinctrl_match_data : scans ports
ur_pinctrl_helpers --> ur_pin_val : builds_and_programs
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Hi @WangJia-UR. Thanks for your PR. I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @WangJia-UR, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds support for the MilkV Titan board and backports PCIe MSI affinity handling and PLIC driver improvements for the UltraRISC DP1000 platform.
- Introduces a new MSI_FLAG_NO_AFFINITY flag to handle PCI MSI controllers that don't support IRQ affinity steering
- Refactors IRQ matrix allocation to use dynamic sizing instead of architecture-specific constants
- Modernizes the RISC-V PLIC driver with fwnode support, improved locking, and early probe capability
- Adds pinctrl driver improvements with proper pin-to-port/pin conversion and generic pinconf handling
- Introduces device tree support for the MilkV Titan board
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| kernel/irq/msi.c | Adds MSI_FLAG_NO_AFFINITY check to avoid setting affinity on unsupported controllers |
| kernel/irq/matrix.c | Refactors to use dynamic allocation with struct_size for flexible matrix sizing |
| include/linux/msi.h | Defines new MSI_FLAG_NO_AFFINITY flag and shifts MSI_FLAG_PCI_IMS |
| arch/x86/include/asm/hw_irq.h | Removes architecture-specific IRQ_MATRIX_BITS constant |
| drivers/pci/controller/* | Removes stub set_affinity implementations and adds MSI_FLAG_NO_AFFINITY across multiple controllers |
| drivers/pci/controller/dwc/pcie-ultrarisc.c | Adds suspend/resume support with MSI mask state preservation |
| drivers/irqchip/irq-sifive-plic.c | Major refactoring to use fwnode, improved error handling, IRQ-safe locking, and early probe support |
| drivers/irqchip/irq-riscv-intc.c | Adds AIA interrupt handling and IEH support for 32-bit systems with extended interrupts |
| drivers/pinctrl/ultrarisc/* | Refactors pinctrl driver with improved port/pin handling and generic pinconf translation |
| include/dt-bindings/pinctrl/ur-dp1000-pinctrl.h | Updates pin configuration macros to remove port/pin from BIAS macro |
| arch/riscv/boot/dts/ultrarisc/* | Adds Titan board DTS, updates EVB/MO board pinctrl, moves pinmux to dp1000.dtsi |
| Documentation/devicetree/bindings/pinctrl/* | Updates binding documentation with new macro format |
Comments suppressed due to low confidence (1)
drivers/pinctrl/ultrarisc/pinctrl-ultrarisc.c:514
- The variable declaration for 'struct resource *res' should appear at the beginning of the function block, not in the middle after an if statement. This violates C89/C90 standards and may cause compilation issues with certain compilers. Move line 514 to the top of the function with other variable declarations.
ur_pinctrl = devm_kzalloc(&pdev->dev, sizeof(*ur_pinctrl), GFP_KERNEL);
if (!ur_pinctrl) {
ret = -ENOMEM;
goto free_pinctrl_desc;
}
struct resource *res;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| const struct ur_port_desc *port_desc; | ||
|
|
||
| for (int i = 0; i < match_data->num_ports; i++) { |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop variable 'i' is declared in the for loop initializer, which is a C99 feature. This may cause compilation issues with strict C89 compilers or certain kernel configurations. Declare 'i' at the beginning of the function instead.
| dev_dbg(pctldev->dev, "%s(%d): pin=%d, num_configs=%d\n", | ||
| __func__, __LINE__, pin, num_configs); | ||
| pin_conf = (struct ur_pin_val *)configs; | ||
| for (int i = 0; i < num_configs; i++) { |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop variable 'i' is declared in the for loop initializer, which is a C99 feature. This may cause compilation issues with strict C89 compilers or certain kernel configurations. Declare 'i' at the beginning of the function instead.
| struct ultrarisc_pcie *ultrarisc_pcie = platform_get_drvdata(pdev); | ||
| struct dw_pcie *pci = ultrarisc_pcie->pci; | ||
| struct dw_pcie_rp *pp = &pci->pp; | ||
| int num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential division by zero: if pp->num_vectors is less than MAX_MSI_IRQS_PER_CTRL (32), num_ctrls will be 0, causing the loop to be skipped but potentially leading to unexpected behavior. Consider adding a validation check or using DIV_ROUND_UP to ensure proper handling of edge cases.
| struct ultrarisc_pcie *ultrarisc_pcie = platform_get_drvdata(pdev); | ||
| struct dw_pcie *pci = ultrarisc_pcie->pci; | ||
| struct dw_pcie_rp *pp = &pci->pp; | ||
| int num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential division by zero: if pp->num_vectors is less than MAX_MSI_IRQS_PER_CTRL (32), num_ctrls will be 0, causing the loop to be skipped but potentially leading to unexpected behavior. Consider adding a validation check or using DIV_ROUND_UP to ensure proper handling of edge cases.
5b2e0ec to
b41915f
Compare
|
1.需要确认下以下fix是否需要 commit ca5b0b7 commit 6eabf65
|
mainline inclusion from mainline-v6.12-rc1 commit 5297bba category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Various PCIe controllers that mux MSIs onto single IRQ line produce these "IRQ%d: set affinity failed" warnings when entering suspend. This has been discussed before [1] [2] and an example test case is included at the end of this commit message. Controller drivers that create MSI IRQ domain with MSI_FLAG_USE_DEF_CHIP_OPS and do not override the .irq_set_affinity() irqchip callback get assigned the default msi_domain_set_affinity() callback. That is not desired on controllers where it is not possible to set affinity of each MSI IRQ line to a specific CPU core due to hardware limitation. Introduce flag MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset if the controller driver did not assign it. This way, migrate_one_irq() can exit right away, without printing the warning. The .irq_set_affinity() implementations which only return -EINVAL can be removed from multiple controller drivers. ``` $ grep 25 /proc/interrupts 25: 0 0 0 0 0 0 0 0 PCIe MSI 0 Edge PCIe PME $ echo core > /sys/power/pm_test ; echo mem > /sys/power/state ... Disabling non-boot CPUs ... IRQ25: set affinity failed(-22). <---------- This is being silenced here psci: CPU7 killed (polled 4 ms) ... ``` [1] https://lore.kernel.org/all/[email protected] [2] https://lore.kernel.org/all/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit 4dff9c3 category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit 114ca29 category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit c7b10ed category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit 363d53a category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit 425c075 category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Jianjun Wang <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit 63e4794 category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Jianjun Wang <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit 2a1297e category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit 57d1992 category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit 7216311 category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit 647e965 category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Nirmal Patel <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit d5bba5b category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
mainline inclusion from mainline-v6.12-rc1 commit abd9b9d category: feature bugzilla: RVCK-Project/rvck#172 -------------------------------- Use MSI_FLAG_NO_AFFINITY, which keeps .irq_set_affinity() unset and allows migrate_one_irq() to exit right away, without warnings like this: IRQ...: set affinity failed(-22) Remove the .irq_set_affinity() implementation that is no longer needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marek Vasut <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Jia Wang <[email protected]>
Enable KEYBOARD_GPIO. Signed-off-by: Jia Wang <[email protected]>
Set error to -ENOMEM if kcalloc() fails or if irq_domain_add_linear() fails inside of plic_probe() instead of returning 0. Fixes: 4d936f1 ("irqchip/sifive-plic: Probe plic driver early for Allwinner D1 platform") Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Charlie Jenkins <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Anup Patel <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/all/20240903-correct_error_codes_sifive_plic-v1-1-d929b79663a2@rivosinc.com Closes: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Jia Wang <[email protected]>
Use riscv_intc_aia_irq() as the low-level interrupt handler instead of the existing riscv_intc_irq() default handler to make demultiplexing work correctly. Also print "using AIA" in the INTC boot banner when AIA is available. Fixes: 3c46fc5 ("irqchip/riscv-intc: Add support for RISC-V AIA") Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jia Wang <[email protected]>
riscv_intc_custom_base is initialized to BITS_PER_LONG, so the second check passes even though AIA provides 64 interrupts. Adjust the condition to only check the custom range for interrupts outside the standard range, and adjust the standard range when AIA is available. Fixes: 3c46fc5 ("irqchip/riscv-intc: Add support for RISC-V AIA") Fixes: 678c607 ("irqchip/riscv-intc: Fix low-level interrupt handler setup for AIA") Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jia Wang <[email protected]>
b41915f to
64663e6
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: opsiff The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary by Sourcery
Add MilkV Titan platform support and enhance RISC-V interrupt/PCIe handling, while cleaning up MSI affinity handling across multiple PCI host controllers.
New Features:
Bug Fixes:
Enhancements: