From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH 1/4] s390/kvm: Handle hosts not supporting s390-virtio. Date: Fri, 10 Aug 2012 01:09:15 +0200 Message-ID: <1DF99033-5FD5-40ED-9221-61E7EA5A9219@suse.de> References: <1344351168-2568-1-git-send-email-cornelia.huck@de.ibm.com> <1344351168-2568-2-git-send-email-cornelia.huck@de.ibm.com> Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1344351168-2568-2-git-send-email-cornelia.huck@de.ibm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Archive: List-Post: To: Cornelia Huck Cc: linux-s390 , Anthony Liguori , Rusty Russell , KVM , Carsten Otte , Sebastian Ott , Marcelo Tosatti , Heiko Carstens , qemu-devel , Christian Borntraeger , Avi Kivity , Martin Schwidefsky List-ID: On 07.08.2012, at 16:52, Cornelia Huck wrote: > Running under a kvm host does not necessarily imply the presence of > a page mapped above the main memory with the virtio information; > however, the code includes a hard coded access to that page. >=20 > Instead, check for the presence of the page and exit gracefully > before we hit an addressing exception if it does not exist. >=20 > Signed-off-by: Cornelia Huck > --- > drivers/s390/kvm/kvm_virtio.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) >=20 > diff --git a/drivers/s390/kvm/kvm_virtio.c = b/drivers/s390/kvm/kvm_virtio.c > index 47cccd5..408447c 100644 > --- a/drivers/s390/kvm/kvm_virtio.c > +++ b/drivers/s390/kvm/kvm_virtio.c > @@ -418,6 +418,21 @@ static void kvm_extint_handler(struct ext_code = ext_code, > } > } >=20 > +static int __init test_devices_support(void) Today we know what this function does, but the next person running into = it has no clue. Maybe add a nice description here that you're trying to = access memory above ram? (is this even what you're doing here? my s390 = asm is slightly rusty) :) Alex > +{ > + int ccode =3D -EIO; > + > + asm volatile( > + "0: cli 0(%1),0\n" > + " ipm %0\n" > + " srl %0,28\n" > + "1:\n" > + EX_TABLE(0b,1b) > + : "+d" (ccode) > + : "a" (kvm_devices) > + : "cc"); > + return ccode; > +} > /* > * Init function for virtio > * devices are in a single page above top of "normal" mem > @@ -443,6 +458,12 @@ static int __init kvm_devices_init(void) > } >=20 > kvm_devices =3D (void *) real_memory_size; > + if (test_devices_support() < 0) { > + vmem_remove_mapping(real_memory_size, PAGE_SIZE); > + root_device_unregister(kvm_root); > + /* No error. */ > + return 0; > + } >=20 > INIT_WORK(&hotplug_work, hotplug_devices); >=20 > --=20 > 1.7.11.4 >=20 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szbr5-0001ZE-6m for qemu-devel@nongnu.org; Thu, 09 Aug 2012 19:09:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Szbr4-0003sK-6q for qemu-devel@nongnu.org; Thu, 09 Aug 2012 19:09:27 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33195 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szbr3-0003rY-SW for qemu-devel@nongnu.org; Thu, 09 Aug 2012 19:09:26 -0400 Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <1344351168-2568-2-git-send-email-cornelia.huck@de.ibm.com> Date: Fri, 10 Aug 2012 01:09:15 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <1DF99033-5FD5-40ED-9221-61E7EA5A9219@suse.de> References: <1344351168-2568-1-git-send-email-cornelia.huck@de.ibm.com> <1344351168-2568-2-git-send-email-cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH 1/4] s390/kvm: Handle hosts not supporting s390-virtio. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck Cc: linux-s390 , Anthony Liguori , Rusty Russell , KVM , Carsten Otte , Sebastian Ott , Marcelo Tosatti , Heiko Carstens , qemu-devel , Christian Borntraeger , Avi Kivity , Martin Schwidefsky On 07.08.2012, at 16:52, Cornelia Huck wrote: > Running under a kvm host does not necessarily imply the presence of > a page mapped above the main memory with the virtio information; > however, the code includes a hard coded access to that page. >=20 > Instead, check for the presence of the page and exit gracefully > before we hit an addressing exception if it does not exist. >=20 > Signed-off-by: Cornelia Huck > --- > drivers/s390/kvm/kvm_virtio.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) >=20 > diff --git a/drivers/s390/kvm/kvm_virtio.c = b/drivers/s390/kvm/kvm_virtio.c > index 47cccd5..408447c 100644 > --- a/drivers/s390/kvm/kvm_virtio.c > +++ b/drivers/s390/kvm/kvm_virtio.c > @@ -418,6 +418,21 @@ static void kvm_extint_handler(struct ext_code = ext_code, > } > } >=20 > +static int __init test_devices_support(void) Today we know what this function does, but the next person running into = it has no clue. Maybe add a nice description here that you're trying to = access memory above ram? (is this even what you're doing here? my s390 = asm is slightly rusty) :) Alex > +{ > + int ccode =3D -EIO; > + > + asm volatile( > + "0: cli 0(%1),0\n" > + " ipm %0\n" > + " srl %0,28\n" > + "1:\n" > + EX_TABLE(0b,1b) > + : "+d" (ccode) > + : "a" (kvm_devices) > + : "cc"); > + return ccode; > +} > /* > * Init function for virtio > * devices are in a single page above top of "normal" mem > @@ -443,6 +458,12 @@ static int __init kvm_devices_init(void) > } >=20 > kvm_devices =3D (void *) real_memory_size; > + if (test_devices_support() < 0) { > + vmem_remove_mapping(real_memory_size, PAGE_SIZE); > + root_device_unregister(kvm_root); > + /* No error. */ > + return 0; > + } >=20 > INIT_WORK(&hotplug_work, hotplug_devices); >=20 > --=20 > 1.7.11.4 >=20