[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 6/7] arm/mpu: Provide a constructor for pr_t type
- To: Ayan Kumar Halder <ayankuma@xxxxxxx>
- From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
- Date: Tue, 29 Apr 2025 19:39:23 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=amd.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; 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=SCk0Z7ugaxLv4T8YXG0YTf0mv/e6tWxSOBRP9hzOzkw=; b=JZ+I0Bnl6YC6UM0yMjwydjQjN4pfIWYcZFXshRQW5rpXYOaUiMEHpqdeRxK05Y+pslboCZ59PW9WGKMb39VJ9t9mUHkkIBL1iWvicnqcunf5Q6yB3B3z09j2/Z0UJ44ZaSfgxIXeZb/mzY07No/aQ5jB69NGiccvAfUwZTHY5DLBB32xv18EActARNRs/EUwjf1OqE5xmeuJyIFPswg8eWzSEGy66Wfd34mSQjwqAi7o/2MTY/ynhrpi3WaKiHTM86Z55q5r4HlNn7bEtAUA/GB5Y87Np6z8amqL2pm624FkQn2TeT64O3p/SGK+2H37IaQHapoLVHoe0RXWJ2uYiw==
- 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=SCk0Z7ugaxLv4T8YXG0YTf0mv/e6tWxSOBRP9hzOzkw=; b=ccelM40GVlvGy56Ca7wpecdaCkcuuV32DuiplbNx2FPAsTraXRIgwoNpq0BOgySw873GASLWI3LTp1Q6A0rlbM8UqJ+BFYFmMSH/qPMsvGMWT5MGO0a3SFCtDdpkswuNfm3mptZ6pCCVfuP0z+nXLbt1trO+430qa+q6RghacK+btbRV5FeAl1GQ114t+uBt3QyVF4stF20gXP5IDQ+9YFKpbqJYONc+SQNaC4iUNNbl/0iNSta47SumWUWctEGFEnvMNDS2PiVrR9xGX/uOS0GqCocKdZ/22FqvCAhgk1MmJqkRSp4XFu27qR0imtb8klo28Xsajeo8wVbls7EDQA==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=Jrr9k2FP3VoAJGecmLbe7lmZFLQTLGDwCffw2b+bTDssmGAnifvYAug0HFde/b2uzgrJKcfSjUDXOiHrKftNa/KnO7ScgqtKFhmgtNc10DP4B9hZBliEdftjTrBOlc286wH4T2EGUD/Jqtr5Mrnnm19P6iuNwFx1Mwg+EfTnMboJAWh7nrmT0r/RU+bcVAALiVE4gPF/P/WNywe1nSkajjFOsaJ7hfamDQKON4ivi558yJLjeoFXaN+yc2XpbNginqtRh0WiGVXGjGQ3I+1tI/dl7HPcE6xEsPLDAGsVJ1LqGZGmK66++vt/L9P2lKq3AdQpGWjQn73EDuCox0xYMQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SsLJVF2kJaAT8F2ZeuoGQSwm9TLTXRuIjzLkeeqWe07DhWHXfgx2hi8xxDiKMAfOpN2lYzpuABBukF/qDoe7Elf1kxyYj3vFFsWU+JmpiQe67HIZroDOtnPxudccfAJjJltBNOcCUSOJyDWf7sOxIxThcXKPVWMTB69zSgLs2nYgAfkGoGJIJS/BAQshMo8j7bw9yQr5aoF6g4HaHPcQwWksjpKqb1gyv5oyMuKUJlbJ8uC2BsEO3NnHL9I/pozResGm+6iWjTg2p/zQlZKAi96kC0vgYCtMg1HDPH5IB1S7eI8TgZWMVlVYqLwCn9Ofs570ZfQgic0Fxmqsp7dvyQ==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Tue, 29 Apr 2025 19:40:13 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Thread-index: AQHbuRpqbs0x64sbw06OBQfYV4WEtLO64q+AgAAnyAA=
- Thread-topic: [PATCH v4 6/7] arm/mpu: Provide a constructor for pr_t type
Hi Ayan,
>> diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c
>> index 40ccf99adc94..2e0aeb486ff8 100644
>> --- a/xen/arch/arm/mpu/mm.c
>> +++ b/xen/arch/arm/mpu/mm.c
>> @@ -9,6 +9,7 @@
>> #include <xen/types.h>
>> #include <asm/mpu.h>
>> #include <asm/mpu/mm.h>
>> +#include <asm/page.h>
>> #include <asm/sysregs.h>
>>
>> struct page_info *frame_table;
>> @@ -151,6 +152,73 @@ void write_protection_region(const pr_t *pr_write,
>> uint8_t sel)
>> BUG(); /* Can't happen */
>> }
>> }
>> +
>> +pr_t pr_of_xenaddr(paddr_t base, paddr_t limit, unsigned int attr_idx)
>> +{
>> + prbar_t prbar;
>> + prlar_t prlar;
>> + pr_t region;
>> +
>> + /* Build up value for PRBAR_EL2. */
>> + prbar = (prbar_t) {
>> + .reg = {
>> + .ap = AP_RW_EL2, /* Read/Write at EL2, no access at
>> EL1/EL0. */
>> + .xn = PRBAR_EL2_XN_ENABLED, /* No need to execute outside
>> .text */
>> + }};
>> +
>> + switch ( attr_idx )
>> + {
>> + case MT_NORMAL_NC:
>> + /*
>> + * ARM ARM: Overlaying the shareability attribute (DDI
>> + * 0406C.b B3-1376 to 1377)
>> + *
>> + * A memory region with a resultant memory type attribute of normal,
>> + * and a resultant cacheability attribute of Inner non-cacheable,
>> + * outer non-cacheable, must have a resultant shareability attribute
>> + * of outer shareable, otherwise shareability is UNPREDICTABLE.
>> + *
>> + * On ARMv8 sharability is ignored and explicitly treated as outer
>> + * shareable for normal inner non-cacheable, outer non-cacheable.
>> + */
>> + prbar.reg.sh = LPAE_SH_OUTER;
>> + break;
>> + case MT_DEVICE_nGnRnE:
>> + case MT_DEVICE_nGnRE:
>> + /*
>> + * Shareability is ignored for non-normal memory, Outer is as
>> + * good as anything.
>> + *
>> + * On ARMv8 sharability is ignored and explicitly treated as outer
>> + * shareable for any device memory type.
>> + */
>> + prbar.reg.sh = LPAE_SH_OUTER;
>> + break;
>> + default:
>> + /* Xen mappings are SMP coherent */
>> + prbar.reg.sh = LPAE_SH_INNER;
>> + }
>> +
>> + /* Build up value for PRLAR_EL2. */
>> + prlar = (prlar_t) {
>> + .reg = {
> #ifdef CONFIG_ARM_64
>> + .ns = 0, /* Hyp mode is in secure world */
> #endif
yes this part will be introduced by you together with the pr_t definition,
in this patch the overall pr_of_xenaddr is protected by CONFIG_ARM_64
Cheers,
Luca
|