From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCUXp-0006wo-9k for qemu-devel@nongnu.org; Wed, 20 Apr 2011 06:22:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QCUXo-0005vI-1D for qemu-devel@nongnu.org; Wed, 20 Apr 2011 06:22:01 -0400 Received: from hall.aurel32.net ([88.191.126.93]:59346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCUXn-0005v3-T2 for qemu-devel@nongnu.org; Wed, 20 Apr 2011 06:21:59 -0400 Date: Wed, 20 Apr 2011 12:21:42 +0200 From: Aurelien Jarno Message-ID: <20110420102142.GJ6388@volta.aurel32.net> References: <1302881578-5357-1-git-send-email-agraf@suse.de> <1302881578-5357-11-git-send-email-agraf@suse.de> <20110418190637.GK16178@volta.aurel32.net> <136378BD-0C8C-48C2-BE67-953D73222A8C@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <136378BD-0C8C-48C2-BE67-953D73222A8C@suse.de> Subject: Re: [Qemu-devel] [PATCH 10/17] s390x: keep hint on virtio managing size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: peter.maydell@linaro.org, QEMU-devel Developers , Richard Henderson On Mon, Apr 18, 2011 at 11:03:59PM +0200, Alexander Graf wrote: > > On 18.04.2011, at 21:06, Aurelien Jarno wrote: > > > On Fri, Apr 15, 2011 at 05:32:51PM +0200, Alexander Graf wrote: > >> The s390x virtio bus keeps management information on virtio after the top > >> of the guest's RAM. We need to be able to tell the guest the size of its > >> RAM (without virtio stuff), but also be able to trap when the guest accesses > >> RAM outside of its scope (including virtio stuff). > >> > >> So we need a variable telling us the size of the virtio stuff, so we can > >> calculate the highest available RAM address from that. > >> > >> While at it, also increase the maximum number of virtio pages, so we play > >> along well with more recent kernels that spawn a ridiculous number of virtio > >> console adapters. > >> > >> Signed-off-by: Alexander Graf > >> --- > >> hw/s390-virtio-bus.c | 3 +++ > >> hw/s390-virtio-bus.h | 2 +- > >> target-s390x/cpu.h | 3 +++ > >> 3 files changed, 7 insertions(+), 1 deletions(-) > >> > >> diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c > >> index bb49e39..a90963b 100644 > >> --- a/hw/s390-virtio-bus.c > >> +++ b/hw/s390-virtio-bus.c > >> @@ -60,6 +60,9 @@ static const VirtIOBindings virtio_s390_bindings; > >> > >> static ram_addr_t s390_virtio_device_num_vq(VirtIOS390Device *dev); > >> > >> +/* length of VirtIO device pages */ > >> +target_phys_addr_t virtio_size = S390_DEVICE_PAGES * TARGET_PAGE_SIZE; > >> + > > > > If this variable is never written, can it be declared const? > > Does that improve anything for exported variables? Do they get put into a ro section then? > Unfortunately, that will still be an exported variable, and it's a pitty to use that just because we can't have a #define in hw/* included in target-*/* . That said I just realized that a lot of target are actually doing that, maybe it's the solution here. Adding a const here will clearly show to people reading the code that it's nothing more than advanced #define. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net