Merge tag 'riscv-for-linus-6.18-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull more RISC-V updates from Paul Walmsley:

 - Support for the RISC-V-standardized RPMI interface.

   RPMI is a platform management communication mechanism between OSes
   running on application processors, and a remote platform management
   processor. Similar to ARM SCMI, TI SCI, etc. This includes irqchip,
   mailbox, and clk changes.

 - Support for the RISC-V-standardized MPXY SBI extension.

   MPXY is a RISC-V-specific standard implementing a shared memory
   mailbox between S-mode operating systems (e.g., Linux) and M-mode
   firmware (e.g., OpenSBI). It is part of this PR since one of its use
   cases is to enable M-mode firmware to act as a single RPMI client for
   all RPMI activity on a core (including S-mode RPMI activity).
   Includes a mailbox driver.

 - Some ACPI-related updates to enable the use of RPMI and MPXY.

 - The addition of Linux-wide memcpy_{from,to}_le32() static inline
   functions, for RPMI use.

 - An ACPI Kconfig change to enable boot logos on any ACPI-using
   architecture (including RISC-V)

 - A RISC-V defconfig change to add GPIO keyboard and event device
   support, for front panel shutdown or reboot buttons

* tag 'riscv-for-linus-6.18-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (26 commits)
  clk: COMMON_CLK_RPMI should depend on RISCV
  ACPI: support BGRT table on RISC-V
  MAINTAINERS: Add entry for RISC-V RPMI and MPXY drivers
  RISC-V: Enable GPIO keyboard and event device in RV64 defconfig
  irqchip/riscv-rpmi-sysmsi: Add ACPI support
  mailbox/riscv-sbi-mpxy: Add ACPI support
  irqchip/irq-riscv-imsic-early: Export imsic_acpi_get_fwnode()
  ACPI: RISC-V: Add RPMI System MSI to GSI mapping
  ACPI: RISC-V: Add support to update gsi range
  ACPI: RISC-V: Create interrupt controller list in sorted order
  ACPI: scan: Update honor list for RPMI System MSI
  ACPI: Add support for nargs_prop in acpi_fwnode_get_reference_args()
  ACPI: property: Refactor acpi_fwnode_get_reference_args() to support nargs_prop
  irqchip: Add driver for the RPMI system MSI service group
  dt-bindings: Add RPMI system MSI interrupt controller bindings
  dt-bindings: Add RPMI system MSI message proxy bindings
  clk: Add clock driver for the RISC-V RPMI clock service group
  dt-bindings: clock: Add RPMI clock service controller bindings
  dt-bindings: clock: Add RPMI clock service message proxy bindings
  mailbox: Add RISC-V SBI message proxy (MPXY) based mailbox driver
  ...
This commit is contained in:
Linus Torvalds
2025-10-04 10:36:22 -07:00
29 changed files with 2981 additions and 84 deletions
@@ -0,0 +1,64 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/riscv,rpmi-clock.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: RISC-V RPMI clock service group based clock controller
maintainers:
- Anup Patel <anup@brainfault.org>
description: |
The RISC-V Platform Management Interface (RPMI) [1] defines a
messaging protocol which is modular and extensible. The supervisor
software can send/receive RPMI messages via SBI MPXY extension [2]
or some dedicated supervisor-mode RPMI transport.
The RPMI specification [1] defines clock service group for accessing
system clocks managed by a platform microcontroller. The supervisor
software can access RPMI clock service group via SBI MPXY channel or
some dedicated supervisor-mode RPMI transport.
===========================================
References
===========================================
[1] RISC-V Platform Management Interface (RPMI) v1.0 (or higher)
https://github.com/riscv-non-isa/riscv-rpmi/releases
[2] RISC-V Supervisor Binary Interface (SBI) v3.0 (or higher)
https://github.com/riscv-non-isa/riscv-sbi-doc/releases
properties:
compatible:
description:
Intended for use by the supervisor software.
const: riscv,rpmi-clock
mboxes:
maxItems: 1
description:
Mailbox channel of the underlying RPMI transport or SBI message proxy channel.
"#clock-cells":
const: 1
description:
Platform specific CLOCK_ID as defined by the RISC-V Platform Management
Interface (RPMI) specification.
required:
- compatible
- mboxes
- "#clock-cells"
additionalProperties: false
examples:
- |
clock-controller {
compatible = "riscv,rpmi-clock";
mboxes = <&mpxy_mbox 0x1000 0x0>;
#clock-cells = <1>;
};
...
@@ -0,0 +1,64 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/riscv,rpmi-mpxy-clock.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: RISC-V RPMI clock service group based message proxy
maintainers:
- Anup Patel <anup@brainfault.org>
description: |
The RISC-V Platform Management Interface (RPMI) [1] defines a
messaging protocol which is modular and extensible. The supervisor
software can send/receive RPMI messages via SBI MPXY extension [2]
or some dedicated supervisor-mode RPMI transport.
The RPMI specification [1] defines clock service group for accessing
system clocks managed by a platform microcontroller. The SBI implementation
(machine mode firmware or hypervisor) can implement an SBI MPXY channel
to allow RPMI clock service group access to the supervisor software.
===========================================
References
===========================================
[1] RISC-V Platform Management Interface (RPMI) v1.0 (or higher)
https://github.com/riscv-non-isa/riscv-rpmi/releases
[2] RISC-V Supervisor Binary Interface (SBI) v3.0 (or higher)
https://github.com/riscv-non-isa/riscv-sbi-doc/releases
properties:
compatible:
description:
Intended for use by the SBI implementation.
const: riscv,rpmi-mpxy-clock
mboxes:
maxItems: 1
description:
Mailbox channel of the underlying RPMI transport.
riscv,sbi-mpxy-channel-id:
$ref: /schemas/types.yaml#/definitions/uint32
description:
The SBI MPXY channel id to be used for providing RPMI access to
the supervisor software.
required:
- compatible
- mboxes
- riscv,sbi-mpxy-channel-id
additionalProperties: false
examples:
- |
clock-service {
compatible = "riscv,rpmi-mpxy-clock";
mboxes = <&rpmi_shmem_mbox 0x8>;
riscv,sbi-mpxy-channel-id = <0x1000>;
};
...
@@ -0,0 +1,67 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/interrupt-controller/riscv,rpmi-mpxy-system-msi.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: RISC-V RPMI system MSI service group based message proxy
maintainers:
- Anup Patel <anup@brainfault.org>
description: |
The RISC-V Platform Management Interface (RPMI) [1] defines a
messaging protocol which is modular and extensible. The supervisor
software can send/receive RPMI messages via SBI MPXY extension [2]
or some dedicated supervisor-mode RPMI transport.
The RPMI specification [1] defines system MSI service group which
allow application processors to receive MSIs upon system events
such as P2A doorbell, graceful shutdown/reboot request, CPU hotplug
event, memory hotplug event, etc from the platform microcontroller.
The SBI implementation (machine mode firmware or hypervisor) can
implement an SBI MPXY channel to allow RPMI system MSI service
group access to the supervisor software.
===========================================
References
===========================================
[1] RISC-V Platform Management Interface (RPMI) v1.0 (or higher)
https://github.com/riscv-non-isa/riscv-rpmi/releases
[2] RISC-V Supervisor Binary Interface (SBI) v3.0 (or higher)
https://github.com/riscv-non-isa/riscv-sbi-doc/releases
properties:
compatible:
description:
Intended for use by the SBI implementation.
const: riscv,rpmi-mpxy-system-msi
mboxes:
maxItems: 1
description:
Mailbox channel of the underlying RPMI transport.
riscv,sbi-mpxy-channel-id:
$ref: /schemas/types.yaml#/definitions/uint32
description:
The SBI MPXY channel id to be used for providing RPMI access to
the supervisor software.
required:
- compatible
- mboxes
- riscv,sbi-mpxy-channel-id
additionalProperties: false
examples:
- |
interrupt-controller {
compatible = "riscv,rpmi-mpxy-system-msi";
mboxes = <&rpmi_shmem_mbox 0x2>;
riscv,sbi-mpxy-channel-id = <0x2000>;
};
...
@@ -0,0 +1,74 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/interrupt-controller/riscv,rpmi-system-msi.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: RISC-V RPMI system MSI service group based interrupt controller
maintainers:
- Anup Patel <anup@brainfault.org>
description: |
The RISC-V Platform Management Interface (RPMI) [1] defines a
messaging protocol which is modular and extensible. The supervisor
software can send/receive RPMI messages via SBI MPXY extension [2]
or some dedicated supervisor-mode RPMI transport.
The RPMI specification [1] defines system MSI service group which
allow application processors to receive MSIs upon system events
such as P2A doorbell, graceful shutdown/reboot request, CPU hotplug
event, memory hotplug event, etc from the platform microcontroller.
The supervisor software can access RPMI system MSI service group via
SBI MPXY channel or some dedicated supervisor-mode RPMI transport.
===========================================
References
===========================================
[1] RISC-V Platform Management Interface (RPMI) v1.0 (or higher)
https://github.com/riscv-non-isa/riscv-rpmi/releases
[2] RISC-V Supervisor Binary Interface (SBI) v3.0 (or higher)
https://github.com/riscv-non-isa/riscv-sbi-doc/releases
allOf:
- $ref: /schemas/interrupt-controller.yaml#
properties:
compatible:
description:
Intended for use by the supervisor software.
const: riscv,rpmi-system-msi
mboxes:
maxItems: 1
description:
Mailbox channel of the underlying RPMI transport or SBI message proxy channel.
msi-parent: true
interrupt-controller: true
"#interrupt-cells":
const: 1
required:
- compatible
- mboxes
- msi-parent
- interrupt-controller
- "#interrupt-cells"
additionalProperties: false
examples:
- |
interrupt-controller {
compatible = "riscv,rpmi-system-msi";
mboxes = <&mpxy_mbox 0x2000 0x0>;
msi-parent = <&imsic_slevel>;
interrupt-controller;
#interrupt-cells = <1>;
};
...
@@ -0,0 +1,124 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mailbox/riscv,rpmi-shmem-mbox.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: RISC-V Platform Management Interface (RPMI) shared memory mailbox
maintainers:
- Anup Patel <anup@brainfault.org>
description: |
The RISC-V Platform Management Interface (RPMI) [1] defines a common shared
memory based RPMI transport. This RPMI shared memory transport integrates as
mailbox controller in the SBI implementation or supervisor software whereas
each RPMI service group is mailbox client in the SBI implementation and
supervisor software.
===========================================
References
===========================================
[1] RISC-V Platform Management Interface (RPMI) v1.0 (or higher)
https://github.com/riscv-non-isa/riscv-rpmi/releases
properties:
compatible:
const: riscv,rpmi-shmem-mbox
reg:
minItems: 2
items:
- description: A2P request queue base address
- description: P2A acknowledgment queue base address
- description: P2A request queue base address
- description: A2P acknowledgment queue base address
- description: A2P doorbell address
reg-names:
minItems: 2
items:
- const: a2p-req
- const: p2a-ack
- enum: [ p2a-req, a2p-doorbell ]
- const: a2p-ack
- const: a2p-doorbell
interrupts:
maxItems: 1
description:
The RPMI shared memory transport supports P2A doorbell as a wired
interrupt and this property specifies the interrupt source.
msi-parent:
description:
The RPMI shared memory transport supports P2A doorbell as a system MSI
and this property specifies the target MSI controller.
riscv,slot-size:
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 64
description:
Power-of-2 RPMI slot size of the RPMI shared memory transport.
riscv,a2p-doorbell-value:
$ref: /schemas/types.yaml#/definitions/uint32
default: 0x1
description:
Value written to the 32-bit A2P doorbell register.
riscv,p2a-doorbell-sysmsi-index:
$ref: /schemas/types.yaml#/definitions/uint32
description:
The RPMI shared memory transport supports P2A doorbell as a system MSI
and this property specifies system MSI index to be used for configuring
the P2A doorbell MSI.
"#mbox-cells":
const: 1
description:
The first cell specifies RPMI service group ID.
required:
- compatible
- reg
- reg-names
- riscv,slot-size
- "#mbox-cells"
anyOf:
- required:
- interrupts
- required:
- msi-parent
additionalProperties: false
examples:
- |
// Example 1 (RPMI shared memory with only 2 queues):
mailbox@10080000 {
compatible = "riscv,rpmi-shmem-mbox";
reg = <0x10080000 0x10000>,
<0x10090000 0x10000>;
reg-names = "a2p-req", "p2a-ack";
msi-parent = <&imsic_mlevel>;
riscv,slot-size = <64>;
#mbox-cells = <1>;
};
- |
// Example 2 (RPMI shared memory with only 4 queues):
mailbox@10001000 {
compatible = "riscv,rpmi-shmem-mbox";
reg = <0x10001000 0x800>,
<0x10001800 0x800>,
<0x10002000 0x800>,
<0x10002800 0x800>,
<0x10003000 0x4>;
reg-names = "a2p-req", "p2a-ack", "p2a-req", "a2p-ack", "a2p-doorbell";
msi-parent = <&imsic_mlevel>;
riscv,slot-size = <64>;
riscv,a2p-doorbell-value = <0x00008000>;
#mbox-cells = <1>;
};
@@ -0,0 +1,51 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mailbox/riscv,sbi-mpxy-mbox.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: RISC-V SBI Message Proxy (MPXY) extension based mailbox
maintainers:
- Anup Patel <anup@brainfault.org>
description: |
The RISC-V SBI Message Proxy (MPXY) extension [1] allows supervisor
software to send messages through the SBI implementation (M-mode
firmware or HS-mode hypervisor). The underlying message protocol
and message format used by the supervisor software could be some
other standard protocol compatible with the SBI MPXY extension
(such as RISC-V Platform Management Interface (RPMI) [2]).
===========================================
References
===========================================
[1] RISC-V Supervisor Binary Interface (SBI) v3.0 (or higher)
https://github.com/riscv-non-isa/riscv-sbi-doc/releases
[2] RISC-V Platform Management Interface (RPMI) v1.0 (or higher)
https://github.com/riscv-non-isa/riscv-rpmi/releases
properties:
compatible:
const: riscv,sbi-mpxy-mbox
"#mbox-cells":
const: 2
description:
The first cell specifies channel_id of the SBI MPXY channel,
the second cell specifies MSG_PROT_ID of the SBI MPXY channel
required:
- compatible
- "#mbox-cells"
additionalProperties: false
examples:
- |
mailbox {
compatible = "riscv,sbi-mpxy-mbox";
#mbox-cells = <2>;
};
+15
View File
@@ -22066,6 +22066,21 @@ F: drivers/perf/riscv_pmu.c
F: drivers/perf/riscv_pmu_legacy.c
F: drivers/perf/riscv_pmu_sbi.c
RISC-V RPMI AND MPXY DRIVERS
M: Rahul Pathak <rahul@summations.net>
M: Anup Patel <anup@brainfault.org>
L: linux-riscv@lists.infradead.org
F: Documentation/devicetree/bindings/clock/riscv,rpmi-clock.yaml
F: Documentation/devicetree/bindings/clock/riscv,rpmi-mpxy-clock.yaml
F: Documentation/devicetree/bindings/interrupt-controller/riscv,rpmi-mpxy-system-msi.yaml
F: Documentation/devicetree/bindings/interrupt-controller/riscv,rpmi-system-msi.yaml
F: Documentation/devicetree/bindings/mailbox/riscv,rpmi-shmem-mbox.yaml
F: Documentation/devicetree/bindings/mailbox/riscv,sbi-mpxy-mbox.yaml
F: drivers/clk/clk-rpmi.c
F: drivers/irqchip/irq-riscv-rpmi-sysmsi.c
F: drivers/mailbox/riscv-sbi-mpxy-mbox.c
F: include/linux/mailbox/riscv-rpmi-message.h
RISC-V SPACEMIT SoC Support
M: Yixun Lan <dlan@gentoo.org>
L: linux-riscv@lists.infradead.org
+2
View File
@@ -140,6 +140,8 @@ CONFIG_MICREL_PHY=y
CONFIG_MICROSEMI_PHY=y
CONFIG_MOTORCOMM_PHY=y
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_EVDEV=y
CONFIG_KEYBOARD_GPIO=y
CONFIG_KEYBOARD_SUN4I_LRADC=m
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
+6
View File
@@ -32,6 +32,7 @@ enum riscv_irqchip_type {
ACPI_RISCV_IRQCHIP_IMSIC = 0x01,
ACPI_RISCV_IRQCHIP_PLIC = 0x02,
ACPI_RISCV_IRQCHIP_APLIC = 0x03,
ACPI_RISCV_IRQCHIP_SMSI = 0x04,
};
int riscv_acpi_get_gsi_info(struct fwnode_handle *fwnode, u32 *gsi_base,
@@ -42,6 +43,7 @@ unsigned long acpi_rintc_ext_parent_to_hartid(unsigned int plic_id, unsigned int
unsigned int acpi_rintc_get_plic_nr_contexts(unsigned int plic_id);
unsigned int acpi_rintc_get_plic_context(unsigned int plic_id, unsigned int ctxt_idx);
int __init acpi_rintc_get_imsic_mmio_info(u32 index, struct resource *res);
int riscv_acpi_update_gsi_range(u32 gsi_base, u32 nr_irqs);
#else
static inline int riscv_acpi_get_gsi_info(struct fwnode_handle *fwnode, u32 *gsi_base,
@@ -76,6 +78,10 @@ static inline int __init acpi_rintc_get_imsic_mmio_info(u32 index, struct resour
return 0;
}
static inline int riscv_acpi_update_gsi_range(u32 gsi_base, u32 nr_irqs)
{
return -ENODEV;
}
#endif /* CONFIG_ACPI */
#endif /* _ASM_RISCV_IRQ_H */
+62
View File
@@ -36,6 +36,7 @@ enum sbi_ext_id {
SBI_EXT_STA = 0x535441,
SBI_EXT_NACL = 0x4E41434C,
SBI_EXT_FWFT = 0x46574654,
SBI_EXT_MPXY = 0x4D505859,
/* Experimentals extensions must lie within this range */
SBI_EXT_EXPERIMENTAL_START = 0x08000000,
@@ -443,6 +444,67 @@ enum sbi_fwft_feature_t {
#define SBI_FWFT_SET_FLAG_LOCK BIT(0)
enum sbi_ext_mpxy_fid {
SBI_EXT_MPXY_GET_SHMEM_SIZE,
SBI_EXT_MPXY_SET_SHMEM,
SBI_EXT_MPXY_GET_CHANNEL_IDS,
SBI_EXT_MPXY_READ_ATTRS,
SBI_EXT_MPXY_WRITE_ATTRS,
SBI_EXT_MPXY_SEND_MSG_WITH_RESP,
SBI_EXT_MPXY_SEND_MSG_WITHOUT_RESP,
SBI_EXT_MPXY_GET_NOTIFICATION_EVENTS,
};
enum sbi_mpxy_attribute_id {
/* Standard channel attributes managed by MPXY framework */
SBI_MPXY_ATTR_MSG_PROT_ID = 0x00000000,
SBI_MPXY_ATTR_MSG_PROT_VER = 0x00000001,
SBI_MPXY_ATTR_MSG_MAX_LEN = 0x00000002,
SBI_MPXY_ATTR_MSG_SEND_TIMEOUT = 0x00000003,
SBI_MPXY_ATTR_MSG_COMPLETION_TIMEOUT = 0x00000004,
SBI_MPXY_ATTR_CHANNEL_CAPABILITY = 0x00000005,
SBI_MPXY_ATTR_SSE_EVENT_ID = 0x00000006,
SBI_MPXY_ATTR_MSI_CONTROL = 0x00000007,
SBI_MPXY_ATTR_MSI_ADDR_LO = 0x00000008,
SBI_MPXY_ATTR_MSI_ADDR_HI = 0x00000009,
SBI_MPXY_ATTR_MSI_DATA = 0x0000000A,
SBI_MPXY_ATTR_EVENTS_STATE_CONTROL = 0x0000000B,
SBI_MPXY_ATTR_STD_ATTR_MAX_IDX,
/*
* Message protocol specific attributes, managed by
* the message protocol specification.
*/
SBI_MPXY_ATTR_MSGPROTO_ATTR_START = 0x80000000,
SBI_MPXY_ATTR_MSGPROTO_ATTR_END = 0xffffffff
};
/* Possible values of MSG_PROT_ID attribute as-per SBI v3.0 (or higher) */
enum sbi_mpxy_msgproto_id {
SBI_MPXY_MSGPROTO_RPMI_ID = 0x0,
};
/* RPMI message protocol specific MPXY attributes */
enum sbi_mpxy_rpmi_attribute_id {
SBI_MPXY_RPMI_ATTR_SERVICEGROUP_ID = SBI_MPXY_ATTR_MSGPROTO_ATTR_START,
SBI_MPXY_RPMI_ATTR_SERVICEGROUP_VERSION,
SBI_MPXY_RPMI_ATTR_IMPL_ID,
SBI_MPXY_RPMI_ATTR_IMPL_VERSION,
SBI_MPXY_RPMI_ATTR_MAX_ID
};
/* Encoding of MSG_PROT_VER attribute */
#define SBI_MPXY_MSG_PROT_VER_MAJOR(__ver) upper_16_bits(__ver)
#define SBI_MPXY_MSG_PROT_VER_MINOR(__ver) lower_16_bits(__ver)
#define SBI_MPXY_MSG_PROT_MKVER(__maj, __min) (((u32)(__maj) << 16) | (u16)(__min))
/* Capabilities available through CHANNEL_CAPABILITY attribute */
#define SBI_MPXY_CHAN_CAP_MSI BIT(0)
#define SBI_MPXY_CHAN_CAP_SSE BIT(1)
#define SBI_MPXY_CHAN_CAP_EVENTS_STATE BIT(2)
#define SBI_MPXY_CHAN_CAP_SEND_WITH_RESP BIT(3)
#define SBI_MPXY_CHAN_CAP_SEND_WITHOUT_RESP BIT(4)
#define SBI_MPXY_CHAN_CAP_GET_NOTIFICATIONS BIT(5)
/* SBI spec version fields */
#define SBI_SPEC_VERSION_DEFAULT 0x1
#define SBI_SPEC_VERSION_MAJOR_SHIFT 24
+1 -1
View File
@@ -461,7 +461,7 @@ config ACPI_HED
config ACPI_BGRT
bool "Boottime Graphics Resource Table support"
depends on EFI && (X86 || ARM64 || LOONGARCH)
depends on EFI
help
This driver adds support for exposing the ACPI Boottime Graphics
Resource Table, which allows the operating system to obtain
+74 -54
View File
@@ -844,13 +844,35 @@ acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
return NULL;
}
static unsigned int acpi_fwnode_get_args_count(struct fwnode_handle *fwnode,
const char *nargs_prop)
{
const struct acpi_device_data *data;
const union acpi_object *obj;
int ret;
data = acpi_device_data_of_node(fwnode);
if (!data)
return 0;
ret = acpi_data_get_property(data, nargs_prop, ACPI_TYPE_INTEGER, &obj);
if (ret)
return 0;
return obj->integer.value;
}
static int acpi_get_ref_args(struct fwnode_reference_args *args,
struct fwnode_handle *ref_fwnode,
const char *nargs_prop,
const union acpi_object **element,
const union acpi_object *end, size_t num_args)
{
u32 nargs = 0, i;
if (nargs_prop)
num_args = acpi_fwnode_get_args_count(ref_fwnode, nargs_prop);
/*
* Assume the following integer elements are all args. Stop counting on
* the first reference (possibly represented as a string) or end of the
@@ -922,45 +944,10 @@ static struct fwnode_handle *acpi_parse_string_ref(const struct fwnode_handle *f
return &dn->fwnode;
}
/**
* __acpi_node_get_property_reference - returns handle to the referenced object
* @fwnode: Firmware node to get the property from
* @propname: Name of the property
* @index: Index of the reference to return
* @num_args: Maximum number of arguments after each reference
* @args: Location to store the returned reference with optional arguments
* (may be NULL)
*
* Find property with @name, verifify that it is a package containing at least
* one object reference and if so, store the ACPI device object pointer to the
* target object in @args->adev. If the reference includes arguments, store
* them in the @args->args[] array.
*
* If there's more than one reference in the property value package, @index is
* used to select the one to return.
*
* It is possible to leave holes in the property value set like in the
* example below:
*
* Package () {
* "cs-gpios",
* Package () {
* ^GPIO, 19, 0, 0,
* ^GPIO, 20, 0, 0,
* 0,
* ^GPIO, 21, 0, 0,
* }
* }
*
* Calling this function with index %2 or index %3 return %-ENOENT. If the
* property does not contain any more values %-ENOENT is returned. The NULL
* entry must be single integer and preferably contain value %0.
*
* Return: %0 on success, negative error code on failure.
*/
int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
const char *propname, size_t index, size_t num_args,
struct fwnode_reference_args *args)
static int acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
const char *propname, const char *nargs_prop,
unsigned int args_count, unsigned int index,
struct fwnode_reference_args *args)
{
const union acpi_object *element, *end;
const union acpi_object *obj;
@@ -1036,10 +1023,10 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
return -EINVAL;
element++;
ret = acpi_get_ref_args(idx == index ? args : NULL,
acpi_fwnode_handle(device),
&element, end, num_args);
nargs_prop, &element, end,
args_count);
if (ret < 0)
return ret;
@@ -1054,10 +1041,9 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
return -EINVAL;
element++;
ret = acpi_get_ref_args(idx == index ? args : NULL,
ref_fwnode, &element, end,
num_args);
ref_fwnode, nargs_prop, &element, end,
args_count);
if (ret < 0)
return ret;
@@ -1079,6 +1065,50 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
return -ENOENT;
}
/**
* __acpi_node_get_property_reference - returns handle to the referenced object
* @fwnode: Firmware node to get the property from
* @propname: Name of the property
* @index: Index of the reference to return
* @num_args: Maximum number of arguments after each reference
* @args: Location to store the returned reference with optional arguments
* (may be NULL)
*
* Find property with @name, verifify that it is a package containing at least
* one object reference and if so, store the ACPI device object pointer to the
* target object in @args->adev. If the reference includes arguments, store
* them in the @args->args[] array.
*
* If there's more than one reference in the property value package, @index is
* used to select the one to return.
*
* It is possible to leave holes in the property value set like in the
* example below:
*
* Package () {
* "cs-gpios",
* Package () {
* ^GPIO, 19, 0, 0,
* ^GPIO, 20, 0, 0,
* 0,
* ^GPIO, 21, 0, 0,
* }
* }
*
* Calling this function with index %2 or index %3 return %-ENOENT. If the
* property does not contain any more values %-ENOENT is returned. The NULL
* entry must be single integer and preferably contain value %0.
*
* Return: %0 on success, negative error code on failure.
*/
int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
const char *propname, size_t index,
size_t num_args,
struct fwnode_reference_args *args)
{
return acpi_fwnode_get_reference_args(fwnode, propname, NULL, index, num_args, args);
}
EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference);
static int acpi_data_prop_read_single(const struct acpi_device_data *data,
@@ -1598,16 +1628,6 @@ acpi_fwnode_property_read_string_array(const struct fwnode_handle *fwnode,
val, nval);
}
static int
acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
const char *prop, const char *nargs_prop,
unsigned int args_count, unsigned int index,
struct fwnode_reference_args *args)
{
return __acpi_node_get_property_reference(fwnode, prop, index,
args_count, args);
}
static const char *acpi_fwnode_get_name(const struct fwnode_handle *fwnode)
{
const struct acpi_device *adev;
+72 -3
View File
@@ -10,6 +10,8 @@
#include "init.h"
#define RISCV_ACPI_INTC_FLAG_PENDING BIT(0)
struct riscv_ext_intc_list {
acpi_handle handle;
u32 gsi_base;
@@ -17,6 +19,7 @@ struct riscv_ext_intc_list {
u32 nr_idcs;
u32 id;
u32 type;
u32 flag;
struct list_head list;
};
@@ -69,6 +72,22 @@ static acpi_status riscv_acpi_update_gsi_handle(u32 gsi_base, acpi_handle handle
return AE_NOT_FOUND;
}
int riscv_acpi_update_gsi_range(u32 gsi_base, u32 nr_irqs)
{
struct riscv_ext_intc_list *ext_intc_element;
list_for_each_entry(ext_intc_element, &ext_intc_list, list) {
if (gsi_base == ext_intc_element->gsi_base &&
(ext_intc_element->flag & RISCV_ACPI_INTC_FLAG_PENDING)) {
ext_intc_element->nr_irqs = nr_irqs;
ext_intc_element->flag &= ~RISCV_ACPI_INTC_FLAG_PENDING;
return 0;
}
}
return -ENODEV;
}
int riscv_acpi_get_gsi_info(struct fwnode_handle *fwnode, u32 *gsi_base,
u32 *id, u32 *nr_irqs, u32 *nr_idcs)
{
@@ -115,20 +134,67 @@ struct fwnode_handle *riscv_acpi_get_gsi_domain_id(u32 gsi)
static int __init riscv_acpi_register_ext_intc(u32 gsi_base, u32 nr_irqs, u32 nr_idcs,
u32 id, u32 type)
{
struct riscv_ext_intc_list *ext_intc_element;
struct riscv_ext_intc_list *ext_intc_element, *node, *prev;
ext_intc_element = kzalloc(sizeof(*ext_intc_element), GFP_KERNEL);
if (!ext_intc_element)
return -ENOMEM;
ext_intc_element->gsi_base = gsi_base;
ext_intc_element->nr_irqs = nr_irqs;
/* If nr_irqs is zero, indicate it in flag and set to max range possible */
if (nr_irqs) {
ext_intc_element->nr_irqs = nr_irqs;
} else {
ext_intc_element->flag |= RISCV_ACPI_INTC_FLAG_PENDING;
ext_intc_element->nr_irqs = U32_MAX - ext_intc_element->gsi_base;
}
ext_intc_element->nr_idcs = nr_idcs;
ext_intc_element->id = id;
list_add_tail(&ext_intc_element->list, &ext_intc_list);
list_for_each_entry(node, &ext_intc_list, list) {
if (node->gsi_base < ext_intc_element->gsi_base)
break;
}
/* Adjust the previous node's GSI range if that has pending registration */
prev = list_prev_entry(node, list);
if (!list_entry_is_head(prev, &ext_intc_list, list)) {
if (prev->flag & RISCV_ACPI_INTC_FLAG_PENDING)
prev->nr_irqs = ext_intc_element->gsi_base - prev->gsi_base;
}
list_add_tail(&ext_intc_element->list, &node->list);
return 0;
}
static acpi_status __init riscv_acpi_create_gsi_map_smsi(acpi_handle handle, u32 level,
void *context, void **return_value)
{
acpi_status status;
u64 gbase;
if (!acpi_has_method(handle, "_GSB")) {
acpi_handle_err(handle, "_GSB method not found\n");
return AE_ERROR;
}
status = acpi_evaluate_integer(handle, "_GSB", NULL, &gbase);
if (ACPI_FAILURE(status)) {
acpi_handle_err(handle, "failed to evaluate _GSB method\n");
return status;
}
riscv_acpi_register_ext_intc(gbase, 0, 0, 0, ACPI_RISCV_IRQCHIP_SMSI);
status = riscv_acpi_update_gsi_handle((u32)gbase, handle);
if (ACPI_FAILURE(status)) {
acpi_handle_err(handle, "failed to find the GSI mapping entry\n");
return status;
}
return AE_OK;
}
static acpi_status __init riscv_acpi_create_gsi_map(acpi_handle handle, u32 level,
void *context, void **return_value)
{
@@ -183,6 +249,9 @@ void __init riscv_acpi_init_gsi_mapping(void)
if (acpi_table_parse_madt(ACPI_MADT_TYPE_APLIC, riscv_acpi_aplic_parse_madt, 0) > 0)
acpi_get_devices("RSCV0002", riscv_acpi_create_gsi_map, NULL, NULL);
/* Unlike PLIC/APLIC, SYSMSI doesn't have MADT */
acpi_get_devices("RSCV0006", riscv_acpi_create_gsi_map_smsi, NULL, NULL);
}
static acpi_handle riscv_acpi_get_gsi_handle(u32 gsi)
+2
View File
@@ -861,6 +861,8 @@ static const char * const acpi_honor_dep_ids[] = {
"INTC10CF", /* IVSC (MTL) driver must be loaded to allow i2c access to camera sensors */
"RSCV0001", /* RISC-V PLIC */
"RSCV0002", /* RISC-V APLIC */
"RSCV0005", /* RISC-V SBI MPXY MBOX */
"RSCV0006", /* RISC-V RPMI SYSMSI */
"PNP0C0F", /* PCI Link Device */
NULL
};
+1 -1
View File
@@ -578,7 +578,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_match_property_string);
* @prop: The name of the property
* @nargs_prop: The name of the property telling the number of
* arguments in the referred node. NULL if @nargs is known,
* otherwise @nargs is ignored. Only relevant on OF.
* otherwise @nargs is ignored.
* @nargs: Number of arguments. Ignored if @nargs_prop is non-NULL.
* @index: Index of the reference, from zero onwards.
* @args: Result structure with reference and integer arguments.
+9
View File
@@ -501,6 +501,15 @@ config COMMON_CLK_SP7021
Not all features of the PLL are currently supported
by the driver.
config COMMON_CLK_RPMI
tristate "Clock driver based on RISC-V RPMI"
depends on RISCV || COMPILE_TEST
depends on MAILBOX
default RISCV
help
Support for clocks based on the clock service group defined by
the RISC-V platform management interface (RPMI) specification.
source "drivers/clk/actions/Kconfig"
source "drivers/clk/analogbits/Kconfig"
source "drivers/clk/baikal-t1/Kconfig"
+1
View File
@@ -86,6 +86,7 @@ obj-$(CONFIG_COMMON_CLK_PWM) += clk-pwm.o
obj-$(CONFIG_CLK_QORIQ) += clk-qoriq.o
obj-$(CONFIG_COMMON_CLK_RK808) += clk-rk808.o
obj-$(CONFIG_COMMON_CLK_RP1) += clk-rp1.o
obj-$(CONFIG_COMMON_CLK_RPMI) += clk-rpmi.o
obj-$(CONFIG_COMMON_CLK_HI655X) += clk-hi655x.o
obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o
obj-$(CONFIG_COMMON_CLK_SCMI) += clk-scmi.o
File diff suppressed because it is too large Load Diff
+7
View File
@@ -634,6 +634,13 @@ config RISCV_IMSIC
select GENERIC_MSI_IRQ
select IRQ_MSI_LIB
config RISCV_RPMI_SYSMSI
bool
depends on RISCV && MAILBOX
select IRQ_DOMAIN_HIERARCHY
select GENERIC_MSI_IRQ
default RISCV
config SIFIVE_PLIC
bool
depends on RISCV
+1
View File
@@ -106,6 +106,7 @@ obj-$(CONFIG_RISCV_INTC) += irq-riscv-intc.o
obj-$(CONFIG_RISCV_APLIC) += irq-riscv-aplic-main.o irq-riscv-aplic-direct.o
obj-$(CONFIG_RISCV_APLIC_MSI) += irq-riscv-aplic-msi.o
obj-$(CONFIG_RISCV_IMSIC) += irq-riscv-imsic-state.o irq-riscv-imsic-early.o irq-riscv-imsic-platform.o
obj-$(CONFIG_RISCV_RPMI_SYSMSI) += irq-riscv-rpmi-sysmsi.o
obj-$(CONFIG_SIFIVE_PLIC) += irq-sifive-plic.o
obj-$(CONFIG_STARFIVE_JH8100_INTC) += irq-starfive-jh8100-intc.o
obj-$(CONFIG_ACLINT_SSWI) += irq-aclint-sswi.o

Some files were not shown because too many files have changed in this diff Show More