[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 5/7] arm/mpu: Introduce utility functions for the pr_t type
- To: Luca Fancellu <luca.fancellu@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: "Orzel, Michal" <michal.orzel@xxxxxxx>
- Date: Mon, 5 May 2025 14:08:10 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mJJ0qItWcnQ3XRF6aJ7N1gpfTNCYMYpoKwARsVw8rrY=; b=aA77pxBXukECKCmivptTRL1YWbk1xuzbwBDU8yhTEKKKpiS/pedPaRdYeeTu2a6qZ6Ok+l81Uoa43a9jsYdMC9aOLNkiCP4SIY6ECqhcrF0XwNN3bnbuU5JjRaoL26r1nXFQpBsPwNMI0P396Sd2SQKAnMq6D8G6ZD72Gx5HY66Pid/cSRvB5DB5fTrE6+Dio3w9T+6iQhV2ewmIcKlBV4chZa5WYlUHN6lLTAUrcowQ0IzIWJrXnHfaxn/3ml8LY3TY+VGGZv6poy7Aix0ETGsfDJnkWYEh85fY/v5qBu5goROlboL7dNJBtuFMsLngfyJyMP2a4cbd5ELwJOa1gA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Hw0Wqakt7LIMbPb8XSIxAtwpYrClvBJiOfVCGtPSaaWxFkOAl59ZDiNBhZZxwKZ/NDPn9Wh6nXHFRjTP3qkMVjtIbMvfh5/5zRpOddrfMDOtwv38u4KkRABnqyvK/cmn5NjOL8/CURmhMnZ2TWe7QQn8WD9E3gNpiGgL4XY0G0J4j2XkxVrYbHIa7S5VJdf9XjOSVI2Ksh12zQfKGdRg4L2TQ5cdFGk6PGJEeX7S78q8z5k0uooTSFjpjTiivE4UJ+hV+95+XZm3zFZvPO0fyZC0p4l+d62Y7Pqr5a1FsuQuPtliQIzeYq9TG0pCNVIcOkpHgwkloKCNMqcQu8IdhA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Mon, 05 May 2025 12:08:28 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 29/04/2025 17:20, Luca Fancellu wrote:
> Introduce few utility function to manipulate and handle the
s/few/a few/
s/function/functions/
> pr_t type.
>
> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
> ---
> v4 changes:
> - Modify comment on top of the helpers. Clarify pr_set_limit
> takes exclusive address.
> Protected common code with #ifdef Arm64 until Arm32 is ready
> with pr_t
> ---
> xen/arch/arm/include/asm/mpu.h | 64 ++++++++++++++++++++++++++++++++++
> 1 file changed, 64 insertions(+)
>
> diff --git a/xen/arch/arm/include/asm/mpu.h b/xen/arch/arm/include/asm/mpu.h
> index 40a86140b6cc..0e0a7f05ade9 100644
> --- a/xen/arch/arm/include/asm/mpu.h
> +++ b/xen/arch/arm/include/asm/mpu.h
> @@ -24,6 +24,70 @@
> #define NUM_MPU_REGIONS_MASK (NUM_MPU_REGIONS - 1)
> #define MAX_MPU_REGION_NR 255
>
> +#ifndef __ASSEMBLY__
> +
> +#ifdef CONFIG_ARM_64
> +/*
> + * Set base address of MPU protection region.
> + *
> + * @pr: pointer to the protection region structure.
> + * @base: base address as base of the protection region.
> + */
> +static inline void pr_set_base(pr_t *pr, paddr_t base)
> +{
> + pr->prbar.reg.base = (base >> MPU_REGION_SHIFT);
Shouldn't you take MPU_REGION_RES0 into account?
~Michal
|