Re: [PATCH v3 1/8] x86/sev: Prepare for using the RMPREAD instruction to access the RMP

From: Neeraj Upadhyay
Date: Wed Oct 16 2024 - 11:02:04 EST




...

> +
> +static int get_rmpentry(u64 pfn, struct rmpentry *entry)
> +{
> + struct rmpentry_raw *e;
> +
> + e = __get_rmpentry(pfn);
> + if (IS_ERR(e))
> + return PTR_ERR(e);
> +
> + /*
> + * Map the RMP table entry onto the RMPREAD output format.
> + * The 2MB region status indicator (hpage_region_status field) is not
> + * calculated, since the overhead could be significant and the field
> + * is not used.
> + */
> + memset(entry, 0, sizeof(*entry));
> + entry->gpa = e->gpa << PAGE_SHIFT;

Nit: Do we need to use PAGE_SHIFT here or hard code the shift to 12?


- Neeraj

> + entry->asid = e->asid;
> + entry->assigned = e->assigned;
> + entry->pagesize = e->pagesize;
> + entry->immutable = e->immutable;
> +
> + return 0;
> +}
> +