From patchwork Fri Jul 21 18:35:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Druzhinin X-Patchwork-Id: 9857497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E8829601C0 for ; Fri, 21 Jul 2017 18:38:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD74928655 for ; Fri, 21 Jul 2017 18:38:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D226C2866B; Fri, 21 Jul 2017 18:38:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 58D7928655 for ; Fri, 21 Jul 2017 18:38:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYcm9-0005x2-U5; Fri, 21 Jul 2017 18:35:45 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYcm8-0005wv-Kb for xen-devel@lists.xenproject.org; Fri, 21 Jul 2017 18:35:44 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id F3/2A-02175-F7942795; Fri, 21 Jul 2017 18:35:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIIsWRWlGSWpSXmKPExsWyU9JRQrfOsyj SYOdmTYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNaNr8T/Gggadir2TJjM1MN5Q6mLk5JAQCJJ4 /HsSK4gtLBAscWDRA2YQW0QgRmLnrB/sIDazgK3EpO5VbCC2kMAXRom9DUkgNpuAgcSpTYtYQ GxeoJr3P6aB9bIIqEocXnGBEcQWFQiX6D3QzwZRIyhxcuYTsHpOARuJU28/sELM95f49mUdI4 QtLnHryXwmiF1qEke7drFA3Jkmcf/MeeYJjPyzkIyahaR9FpJ2CNtCYub881BxeYntb+cwQ9h BEk+PfmXCFI+W+PZqLtsCRo5VjBrFqUVlqUW6huZ6SUWZ6RkluYmZObqGBqZ6uanFxYnpqTmJ ScV6yfm5mxiBwc8ABDsYL572PMQoycGkJMqraVUUKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mC9 487UE6wKDU9tSItMwcYhzBpCQ4eJRHetSBp3uKCxNzizHSI1ClGXY4Nq9d/YRJiycvPS5US5/ 0CUiQAUpRRmgc3ApYSLjHKSgnzMgIdJcRTkFqUm1mCKv+KUZyDUUmY9wDIFJ7MvBK4Ta+AjmA COuKRWwHIESWJCCmpBkbuXUXrKrJ/mEhr90pKfO6Sc5P6dG3yta59Z0/fvF/yqOrlgsWX1i0z PLNo2m9+3ssJ2kkv+AJ5vnyZffJ6k3+jdFGD7FKj7wdu5BTZee9r4lRo/7Qn+edFnv1r9ksY8 ehyppxtS/0nWDu7RGod16sStQnnCsRO3vh69pTlkY/xM+wulaQsjLygxFKckWioxVxUnAgASF MlxQQDAAA= X-Env-Sender: prvs=368c2a73c=igor.druzhinin@citrix.com X-Msg-Ref: server-14.tower-206.messagelabs.com!1500662142!65145829!1 X-Originating-IP: [185.25.65.24] X-SpamReason: No, hits=0.0 required=7.0 tests=received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49892 invoked from network); 21 Jul 2017 18:35:42 -0000 Received: from smtp.eu.citrix.com (HELO SMTP.EU.CITRIX.COM) (185.25.65.24) by server-14.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 21 Jul 2017 18:35:42 -0000 X-IronPort-AV: E=Sophos; i="5.40,391,1496102400"; d="scan'208,223"; a="49727924" To: Anthony PERARD , Stefano Stabellini References: <1500416562-27337-1-git-send-email-sstabellini@kernel.org> <1500416562-27337-6-git-send-email-sstabellini@kernel.org> <20170721135057.GJ1587@perard.uk.xensource.com> From: Igor Druzhinin Message-ID: Date: Fri, 21 Jul 2017 19:35:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170721135057.GJ1587@perard.uk.xensource.com> Content-Language: en-US X-ClientProxiedBy: FTLPEX02CAS03.citrite.net (10.13.99.94) To AMSPEX02CL01.citrite.net (10.69.22.125) Cc: xen-devel@lists.xenproject.org, qemu-devel@nongnu.org Subject: Re: [Xen-devel] [PULL for-2.10 6/7] xen/mapcache: introduce xen_replace_cache_entry() 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 21/07/17 14:50, Anthony PERARD wrote: > On Tue, Jul 18, 2017 at 03:22:41PM -0700, Stefano Stabellini wrote: >> From: Igor Druzhinin > > ... > >> +static uint8_t *xen_replace_cache_entry_unlocked(hwaddr old_phys_addr, >> + hwaddr new_phys_addr, >> + hwaddr size) >> +{ >> + MapCacheEntry *entry; >> + hwaddr address_index, address_offset; >> + hwaddr test_bit_size, cache_size = size; >> + >> + address_index = old_phys_addr >> MCACHE_BUCKET_SHIFT; >> + address_offset = old_phys_addr & (MCACHE_BUCKET_SIZE - 1); >> + >> + assert(size); >> + /* test_bit_size is always a multiple of XC_PAGE_SIZE */ >> + test_bit_size = size + (old_phys_addr & (XC_PAGE_SIZE - 1)); >> + if (test_bit_size % XC_PAGE_SIZE) { >> + test_bit_size += XC_PAGE_SIZE - (test_bit_size % XC_PAGE_SIZE); >> + } >> + cache_size = size + address_offset; >> + if (cache_size % MCACHE_BUCKET_SIZE) { >> + cache_size += MCACHE_BUCKET_SIZE - (cache_size % MCACHE_BUCKET_SIZE); >> + } >> + >> + entry = &mapcache->entry[address_index % mapcache->nr_buckets]; >> + while (entry && !(entry->paddr_index == address_index && >> + entry->size == cache_size)) { >> + entry = entry->next; >> + } >> + if (!entry) { >> + DPRINTF("Trying to update an entry for %lx " \ >> + "that is not in the mapcache!\n", old_phys_addr); >> + return NULL; >> + } >> + >> + address_index = new_phys_addr >> MCACHE_BUCKET_SHIFT; >> + address_offset = new_phys_addr & (MCACHE_BUCKET_SIZE - 1); >> + >> + fprintf(stderr, "Replacing a dummy mapcache entry for %lx with %lx\n", >> + old_phys_addr, new_phys_addr); > > Looks likes this does not build on 32bits. > in: http://logs.test-lab.xenproject.org/osstest/logs/112041/build-i386/6.ts-xen-build.log > > /home/osstest/build.112041.build-i386/xen/tools/qemu-xen-dir/hw/i386/xen/xen-mapcache.c: In function 'xen_replace_cache_entry_unlocked': > /home/osstest/build.112041.build-i386/xen/tools/qemu-xen-dir/hw/i386/xen/xen-mapcache.c:539:13: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'hwaddr' [-Werror=format=] > old_phys_addr, new_phys_addr); > ^ > /home/osstest/build.112041.build-i386/xen/tools/qemu-xen-dir/hw/i386/xen/xen-mapcache.c:539:13: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'hwaddr' [-Werror=format=] > cc1: all warnings being treated as errors > CC i386-softmmu/target/i386/gdbstub.o > /home/osstest/build.112041.build-i386/xen/tools/qemu-xen-dir/rules.mak:66: recipe for target 'hw/i386/xen/xen-mapcache.o' failed > >> + >> + xen_remap_bucket(entry, entry->vaddr_base, >> + cache_size, address_index, false); >> + if (!test_bits(address_offset >> XC_PAGE_SHIFT, >> + test_bit_size >> XC_PAGE_SHIFT, >> + entry->valid_mapping)) { >> + DPRINTF("Unable to update a mapcache entry for %lx!\n", old_phys_addr); >> + return NULL; >> + } >> + >> + return entry->vaddr_base + address_offset; >> +} >> + > Please, accept the attached patch to fix the issue. Igor From 69a3afa453e283e92ddfd76109b203a20a02524c Mon Sep 17 00:00:00 2001 From: Igor Druzhinin Date: Fri, 21 Jul 2017 19:27:41 +0100 Subject: [PATCH] xen: fix compilation on 32-bit hosts Signed-off-by: Igor Druzhinin --- hw/i386/xen/xen-mapcache.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c index 84cc4a2..540406a 100644 --- a/hw/i386/xen/xen-mapcache.c +++ b/hw/i386/xen/xen-mapcache.c @@ -529,7 +529,7 @@ static uint8_t *xen_replace_cache_entry_unlocked(hwaddr old_phys_addr, entry = entry->next; } if (!entry) { - DPRINTF("Trying to update an entry for %lx " \ + DPRINTF("Trying to update an entry for "TARGET_FMT_plx \ "that is not in the mapcache!\n", old_phys_addr); return NULL; } @@ -537,15 +537,16 @@ static uint8_t *xen_replace_cache_entry_unlocked(hwaddr old_phys_addr, address_index = new_phys_addr >> MCACHE_BUCKET_SHIFT; address_offset = new_phys_addr & (MCACHE_BUCKET_SIZE - 1); - fprintf(stderr, "Replacing a dummy mapcache entry for %lx with %lx\n", - old_phys_addr, new_phys_addr); + fprintf(stderr, "Replacing a dummy mapcache entry for "TARGET_FMT_plx \ + " with "TARGET_FMT_plx"\n", old_phys_addr, new_phys_addr); xen_remap_bucket(entry, entry->vaddr_base, cache_size, address_index, false); if(!test_bits(address_offset >> XC_PAGE_SHIFT, test_bit_size >> XC_PAGE_SHIFT, entry->valid_mapping)) { - DPRINTF("Unable to update a mapcache entry for %lx!\n", old_phys_addr); + DPRINTF("Unable to update a mapcache entry for "TARGET_FMT_plx"!\n", + old_phys_addr); return NULL; } -- 2.7.4