From patchwork Tue Sep 12 10:03:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112265 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674132edi; Tue, 12 Sep 2017 03:05:29 -0700 (PDT) X-Google-Smtp-Source: AOwi7QD7HSDvw6yfIUBhabzsIxsRiuKg+yfXg74XPf7ZgyKS3oGHirGwfplYBvhHhCGv5mE6Qwjf X-Received: by 10.107.141.130 with SMTP id p124mr9502743iod.288.1505210729747; Tue, 12 Sep 2017 03:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210729; cv=none; d=google.com; s=arc-20160816; b=gv9VINKenbPY1tqQcFHAqwGpH9ECDoFucYeoxBts0O/AuGN54i9IYXDQ07QgxU9yNv yDMkYgIC4Dd8A+w+PBSMvzjuCNo6+724ayvaH/6JFTXYPezWDqetaVmKrr1KuUe5GZb+ e6u/l9a0K9QayQsLMG8udZz1LyudPSLqtqICrQ6vS0vJXndeVIykzBinMlP2ogsqi0fH 50ItOhX9CZSmGfAeg2VccsS3qxKUAieP2jqp03qRwXqWvvquYyWu/wCxFvgszCOHH3E/ jGLxqbiXXWqoUHxO/Q/N+pT6WqzBiEw+QQUZ3zWzKqVokT4XrWNK0tH53ZxQHvSNnehZ iXBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=cp1kXcXKvMl17Nr6LJUNFda7X9y/Y5EnTDXWw4+KjV4=; b=ABZjHgAZfJFX4RCGeF69BTOSgl58h4D++cedZ1qmN1M+rHKAatYC2mDHCObsa2991O XffB6w+wDihCp67XPRGPc51Il4Y8bskyeqq5CVAj0Yv+vdL7Z5BNSTfW0Y/SbQzU2PvG ZJV9qt5uNW8CfAgd/0NvxaqtHgb0oI7Bjy/pettPxMJtAeYeWKyEFBxn7xD5CIpLsScj zeaBZUb2IlHKeJdJkFCOGKlzcfCd1IcGt3IsTr2Q0Vt7YST13Hyy50pa/CTAPnL3o4Kn 0oKJ2X6jqnwIhPe90T9HmRcNLIwEq1U+hAsjfzWYMKyknuni06Eb+IlVcvH/JGIAGn53 qzNg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id i68si11169315itf.10.2017.09.12.03.05.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:29 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri30-0003Ai-An; Tue, 12 Sep 2017 10:04:02 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2z-00038Q-7s for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:01 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id EF/51-02202-011B7B95; Tue, 12 Sep 2017 10:04:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsVysyfVTZdv4/Z Ig1/vTCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ox9b9cwFrz2qNi25Q5zA+Nn8y5GLg4hgc2M Ene/nGWEcE4zSjTvu8vcxcjJwSagKXHn8ycmEFtEQFri2ufLjCA2s0CkxOEPP9hBbGEBV4kbW 9vBalgEVCV6ty5jAbF5BSwlju6YDjZHQkBeYlfbRVYQmxMovuLjLzYQW0jAQuL7yx+MExi5Fz AyrGLUKE4tKkst0jWy1EsqykzPKMlNzMzRNTQw1ctNLS5OTE/NSUwq1kvOz93ECPRwPQMD4w7 Gy1v8DjFKcjApifIeWb89UogvKT+lMiOxOCO+qDQntfgQowwHh5IE73mQnGBRanpqRVpmDjDU YNISHDxKIrxxIGne4oLE3OLMdIjUKUZjjkc37v5h4ui4CSSFWPLy81KlxHnfgJQKgJRmlObBD YLFwCVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrx3QKbwZOaVwO17BXQKE9ApPJe2gJxSko iQkmpgTN18VfSG5Mqzyyuf+LIHdxkzL/FiM+E/O0nbtS3C4apCiVF0o0qQ7PcWq9WcB1y2LFp wW5jh8bK19y0jj62S/HLtG/N7m63nIiZ5Hrn/XiFoZ1n52beGFbJ5AtsPHb14eItUC1PArFtv l4Te0F/i/+PW/JfBbw+/NDiu2luZleq6ban5Fr53K5VYijMSDbWYi4oTASxgsLR8AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1505210638!109495371!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36622 invoked from network); 12 Sep 2017 10:03:58 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:03:58 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C69DF15A2; Tue, 12 Sep 2017 03:03:57 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D86C83F578; Tue, 12 Sep 2017 03:03:56 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:21 +0100 Message-Id: <20170912100330.2168-16-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 15/24] xen/arm: page: Prefix memory types with MT_ X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" This will avoid confusion in the code when using them. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Andre's reviewed-by --- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mm.c | 28 ++++++++++++++-------------- xen/arch/arm/platforms/vexpress.c | 2 +- xen/drivers/video/arm_hdlcd.c | 2 +- xen/include/asm-arm/page.h | 38 +++++++++++++++++++------------------- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index 7403ec0c0e..9c183f96da 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -54,7 +54,7 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len) s = paddr & (PAGE_SIZE-1); l = min(PAGE_SIZE - s, len); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), BUFFERABLE); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), MT_BUFFERABLE); memcpy(dst, src + s, l); clean_dcache_va_range(dst, l); diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 5716ef1123..7ffeb36bfa 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -290,7 +290,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) switch ( attr ) { - case BUFFERABLE: + case MT_BUFFERABLE: /* * ARM ARM: Overlaying the shareability attribute (DDI * 0406C.b B3-1376 to 1377) @@ -305,8 +305,8 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) */ e.pt.sh = LPAE_SH_OUTER; break; - case UNCACHED: - case DEV_SHARED: + case MT_UNCACHED: + case MT_DEV_SHARED: /* * Shareability is ignored for non-Normal memory, Outer is as * good as anything. @@ -369,7 +369,7 @@ static void __init create_mappings(lpae_t *second, count = nr_mfns / LPAE_ENTRIES; p = second + second_linear_offset(virt_offset); - pte = mfn_to_xen_entry(_mfn(base_mfn), WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(base_mfn), MT_WRITEALLOC); if ( granularity == 16 * LPAE_ENTRIES ) pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */ for ( i = 0; i < count; i++ ) @@ -422,7 +422,7 @@ void *map_domain_page(mfn_t mfn) else if ( map[slot].pt.avail == 0 ) { /* Commandeer this 2MB slot */ - pte = mfn_to_xen_entry(_mfn(slot_mfn), WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_WRITEALLOC); pte.pt.avail = 1; write_pte(map + slot, pte); break; @@ -543,7 +543,7 @@ static inline lpae_t pte_of_xenaddr(vaddr_t va) { paddr_t ma = va + phys_offset; - return mfn_to_xen_entry(maddr_to_mfn(ma), WRITEALLOC); + return mfn_to_xen_entry(maddr_to_mfn(ma), MT_WRITEALLOC); } /* Map the FDT in the early boot page table */ @@ -652,7 +652,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* Initialise xen second level entries ... */ /* ... Xen's text etc */ - pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC); pte.pt.xn = 0;/* Contains our text mapping! */ xen_second[second_table_offset(XEN_VIRT_START)] = pte; @@ -669,7 +669,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* ... Boot Misc area for xen relocation */ dest_va = BOOT_RELOC_VIRT_START; - pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC); /* Map the destination in xen_second. */ xen_second[second_table_offset(dest_va)] = pte; /* Map the destination in boot_second. */ @@ -700,7 +700,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT); if ( !is_kernel(va) ) break; - pte = mfn_to_xen_entry(mfn, WRITEALLOC); + pte = mfn_to_xen_entry(mfn, MT_WRITEALLOC); pte.pt.table = 1; /* 4k mappings always have this bit set */ if ( is_kernel_text(va) || is_kernel_inittext(va) ) { @@ -771,7 +771,7 @@ int init_secondary_pagetables(int cpu) for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ ) { pte = mfn_to_xen_entry(virt_to_mfn(domheap+i*LPAE_ENTRIES), - WRITEALLOC); + MT_WRITEALLOC); pte.pt.table = 1; write_pte(&first[first_table_offset(DOMHEAP_VIRT_START+i*FIRST_SIZE)], pte); } @@ -869,13 +869,13 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, mfn_t first_mfn = alloc_boot_pages(1, 1); clear_page(mfn_to_virt(first_mfn)); - pte = mfn_to_xen_entry(first_mfn, WRITEALLOC); + pte = mfn_to_xen_entry(first_mfn, MT_WRITEALLOC); pte.pt.table = 1; write_pte(p, pte); first = mfn_to_virt(first_mfn); } - pte = mfn_to_xen_entry(_mfn(mfn), WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(mfn), MT_WRITEALLOC); /* TODO: Set pte.pt.contig when appropriate. */ write_pte(&first[first_table_offset(vaddr)], pte); @@ -915,7 +915,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) for ( i = 0; i < nr_second; i++ ) { clear_page(mfn_to_virt(mfn_add(second_base, i))); - pte = mfn_to_xen_entry(mfn_add(second_base, i), WRITEALLOC); + pte = mfn_to_xen_entry(mfn_add(second_base, i), MT_WRITEALLOC); pte.pt.table = 1; write_pte(&xen_first[first_table_offset(FRAMETABLE_VIRT_START)+i], pte); } @@ -969,7 +969,7 @@ static int create_xen_table(lpae_t *entry) if ( p == NULL ) return -ENOMEM; clear_page(p); - pte = mfn_to_xen_entry(virt_to_mfn(p), WRITEALLOC); + pte = mfn_to_xen_entry(virt_to_mfn(p), MT_WRITEALLOC); pte.pt.table = 1; write_pte(entry, pte); return 0; diff --git a/xen/arch/arm/platforms/vexpress.c b/xen/arch/arm/platforms/vexpress.c index a26ac324ba..9badbc079d 100644 --- a/xen/arch/arm/platforms/vexpress.c +++ b/xen/arch/arm/platforms/vexpress.c @@ -65,7 +65,7 @@ int vexpress_syscfg(int write, int function, int device, uint32_t *data) uint32_t *syscfg = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC); int ret = -1; - set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), DEV_SHARED); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), MT_DEV_SHARED); if ( syscfg[V2M_SYS_CFGCTRL/4] & V2M_SYS_CFG_START ) goto out; diff --git a/xen/drivers/video/arm_hdlcd.c b/xen/drivers/video/arm_hdlcd.c index 3915f731f5..5fa7f518b1 100644 --- a/xen/drivers/video/arm_hdlcd.c +++ b/xen/drivers/video/arm_hdlcd.c @@ -227,7 +227,7 @@ void __init video_init(void) /* uses FIXMAP_MISC */ set_pixclock(videomode->pixclock); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), DEV_SHARED); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), MT_DEV_SHARED); HDLCD[HDLCD_COMMAND] = 0; HDLCD[HDLCD_LINELENGTH] = videomode->xres * bytes_per_pixel; diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index ee0422579b..30fcfa0778 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -25,15 +25,15 @@ * LPAE Memory region attributes. Indexed by the AttrIndex bits of a * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1. * - * ai encoding - * UNCACHED 000 0000 0000 -- Strongly Ordered - * BUFFERABLE 001 0100 0100 -- Non-Cacheable - * WRITETHROUGH 010 1010 1010 -- Write-through - * WRITEBACK 011 1110 1110 -- Write-back - * DEV_SHARED 100 0000 0100 -- Device - * ?? 101 - * reserved 110 - * WRITEALLOC 111 1111 1111 -- Write-back write-allocate + * ai encoding + * MT_UNCACHED 000 0000 0000 -- Strongly Ordered + * MT_BUFFERABLE 001 0100 0100 -- Non-Cacheable + * MT_WRITETHROUGH 010 1010 1010 -- Write-through + * MT_WRITEBACK 011 1110 1110 -- Write-back + * MT_DEV_SHARED 100 0000 0100 -- Device + * ?? 101 + * reserved 110 + * MT_WRITEALLOC 111 1111 1111 -- Write-back write-allocate */ #define MAIR0VAL 0xeeaa4400 #define MAIR1VAL 0xff000004 @@ -47,16 +47,16 @@ * registers, as defined above. * */ -#define UNCACHED 0x0 -#define BUFFERABLE 0x1 -#define WRITETHROUGH 0x2 -#define WRITEBACK 0x3 -#define DEV_SHARED 0x4 -#define WRITEALLOC 0x7 - -#define PAGE_HYPERVISOR (WRITEALLOC) -#define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED) -#define PAGE_HYPERVISOR_WC (BUFFERABLE) +#define MT_UNCACHED 0x0 +#define MT_BUFFERABLE 0x1 +#define MT_WRITETHROUGH 0x2 +#define MT_WRITEBACK 0x3 +#define MT_DEV_SHARED 0x4 +#define MT_WRITEALLOC 0x7 + +#define PAGE_HYPERVISOR (MT_WRITEALLOC) +#define PAGE_HYPERVISOR_NOCACHE (MT_DEV_SHARED) +#define PAGE_HYPERVISOR_WC (MT_BUFFERABLE) /* * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be