Skip to content

pmp v1 implementation - #576

Open
dd-dreams wants to merge 3 commits into
AsahiLinux:asahi-wipfrom
dd-dreams:pmp-v1-impl
Open

pmp v1 implementation#576
dd-dreams wants to merge 3 commits into
AsahiLinux:asahi-wipfrom
dd-dreams:pmp-v1-impl

Conversation

@dd-dreams

Copy link
Copy Markdown

No description provided.

@dd-dreams
dd-dreams force-pushed the pmp-v1-impl branch 4 times, most recently from 16f6bab to 3dc39ca Compare August 23, 2026 19:00
This driver adds support for PMP version 1 SoC.

Signed-off-by: dd-dreams <80887265+dd-dreams@users.noreply.github.com>
Signed-off-by: dd-dreams <80887265+dd-dreams@users.noreply.github.com>
Signed-off-by: dd-dreams <80887265+dd-dreams@users.noreply.github.com>
iommus = <&pmp_dart 0>;

apple,init-ranges = <0x0 0x00024000 0x0 0x4000>,
<0x0 0x00064000 0x0 0x4000>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to have just one cell here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How so?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every single address and size fits in 32 bit, so <0x00024000 0x4000>, and so on

required:
- compatible

additionalProperties: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will not fly upstream, they want everything documented.

select PM_GENERIC_DOMAINS

help
Enable support for the Apple PMPv1 report control driver.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something went wrong with formatting here.

This provides power-domain support for PMPv1 report entries
described in the device tree on Apple SoCs.

Say 'y' if you have an Apple machine with PMPv1.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"An Apple machine with base M1 or earlier"

#[pin]
dev: ARef<device::Device>,
#[pin]
node: of::Node,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just get all the data you need from dt in init, and store it in the parsed form.

Comment thread drivers/soc/apple/Kconfig
fabric and other uncore components.

Say 'y' here if you have an Apple M1 chip.
Say 'n' here if you don't have an Apple M1 chip.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be complaints from checkpatch

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore this specific one


let mut err = 0;

let mut map_addresses =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not abuse nested functions like this.

map_addresses(0, 14, dva)?;

// 2nd region
dva = 0xc1000000;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should those be in dts?


#[cfg(CONFIG_APPLE_PMP_V1_REPORT = "y")]
pub mod pmdomain;
pub mod pmp_v1_bridge;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also be gated?

impl pmp_v1_bridge::DevPwrBridge for PmpData {
fn send_devpwr(&self, dev: u64, enable: bool) -> Result<()> {
let msg = (OPC_DEVPWR << OPC_SHIFT) + (dev << 16) + enable as u64;
self.recv_message(msg)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is confusing, we want to send a message, but passing it to a recv function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants