public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Carsten Otte <cotte@de.ibm.com>
Cc: EHRHARDT@de.ibm.com, arnd@arndb.de, hollisb@us.ibm.com,
	kvm-devel@lists.sourceforge.net, heiko.carstens@de.ibm.com,
	jeroney@us.ibm.com, Avi Kivity <avi@qumranet.com>,
	virtualization@lists.linux-foundation.org,
	borntraeger@de.ibm.com, schwidefsky@de.ibm.com,
	rvdheij@gmail.com, os@de.ibm.com, jblunck@suse.de, "Zhang,
	 Xiantao" <xiantao.zhang@intel.com>
Subject: Re: [RFC/PATCH 15/15] guest: virtio device support, and kvm hypercalls
Date: Fri, 21 Mar 2008 11:24:49 +1100	[thread overview]
Message-ID: <200803211124.49829.rusty@rustcorp.com.au> (raw)
In-Reply-To: <1206030328.6690.66.camel@cotte.boeblingen.de.ibm.com>

On Friday 21 March 2008 03:25:28 Carsten Otte wrote:
> +static void kvm_set_status(struct virtio_device *vdev, u8 status)
> +{
> +	BUG_ON(!status);
> +	to_kvmdev(vdev)->desc->status = status;
> +}
> +
> +/*
> + * To reset the device, we (ab)use the NOTIFY hypercall, with the descriptor
> + * address of the device.  The Host will zero the status and all the 
> + * features. 
> + */
> +static void kvm_reset(struct virtio_device *vdev)
> +{
> +	unsigned long offset = (void *)to_kvmdev(vdev)->desc - kvm_devices;
> +
> +	kvm_hypercall1(1237, (max_pfn<<PAGE_SHIFT) + offset);
> +}

I'd recommend a hypercall after set_status, as well as reset.  The
reason lguest doesn't do this is that we don't do feature negotiation
(assuming guest kernel matches host kernel).  In general, the host
needs to know when the VIRTIO_CONFIG_S_DRIVER_OK is set so it can see
what features the guest driver accepted.

Overloading the notify hypercall is kind of a hack too, but it works so
no real need to change that.

> + * The root device for the kvm virtio devices.
> + * This makes them appear as /sys/devices/kvm/0,1,2 not /sys/devices/0,1,2.
> + */ 
> +static struct device kvm_root = {
> +	.parent = NULL,
> +	.bus_id = "kvm_s390",
> +};

You mean /sys/devices/kvm_s390/0,1,2?

> +static int __init kvm_devices_init(void)
> +{
> +	if (!MACHINE_IS_KVM)
> +		return -ENODEV;
> +
> +	if (device_register(&kvm_root) != 0)
> +		panic("Could not register kvm root");
> +
> +	if (add_shared_memory((max_pfn) << PAGE_SHIFT, PAGE_SIZE)) {
> +		device_unregister(&kvm_root);
> +		return -ENOMEM;
> +	}

Hmm, panic on device_register fail, but -ENOMEM on add_shared_memory fail?
My theory was that since this is boot time, panic() is the right thing.

Cheers,
Rusty.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  reply	other threads:[~2008-03-21  0:24 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1206028710.6690.21.camel@cotte.boeblingen.de.ibm.com>
2008-03-20 16:24 ` [RFC/PATCH 01/15] preparation: provide hook to enable pgstes in user pagetable Carsten Otte
2008-03-20 17:28   ` Jeremy Fitzhardinge
2008-03-20 19:13     ` Dave Hansen
2008-03-20 20:35       ` Carsten Otte
2008-03-21 18:29         ` [kvm-devel] " Dave Hansen
2008-03-21 19:03           ` Carsten Otte
2008-03-22 17:57           ` Heiko Carstens
2008-03-23 10:15             ` Avi Kivity
2008-03-23 18:23               ` [kvm-devel] " Martin Schwidefsky
2008-03-24  6:57                 ` Avi Kivity
2008-03-25  6:08                   ` Carsten Otte
2008-03-25  6:12                     ` Avi Kivity
2008-03-25 15:37           ` Carsten Otte
2008-03-20 16:24 ` [RFC/PATCH 02/15] preparation: host memory management changes for s390 kvm Carsten Otte
2008-03-20 16:24 ` [RFC/PATCH 03/15] preparation: address of the 64bit extint parm in lowcore Carsten Otte
2008-03-20 16:24 ` [RFC/PATCH 04/15] preparation: split sysinfo defintions for kvm use Carsten Otte
2008-03-20 16:24 ` [RFC/PATCH 05/15] kvm-s390: s390 arch backend for the kvm kernel module Carsten Otte
2008-03-20 16:43   ` [RFC/PATCH 05/15] KVM_MAX_VCPUS Hollis Blanchard
2008-03-20 16:48     ` Carsten Otte
2008-03-21 10:41       ` [kvm-devel] " Avi Kivity
2008-03-21 11:13         ` Carsten Otte
2008-03-20 16:25 ` [RFC/PATCH 06/15] kvm-s390: sie intercept handling Carsten Otte
2008-03-21 10:53   ` [kvm-devel] " Avi Kivity
2008-03-21 11:26     ` Carsten Otte
2008-03-20 16:25 ` [RFC/PATCH 07/15] kvm-s390: interrupt subsystem, cpu timer, waitpsw Carsten Otte
2008-03-20 16:25 ` [RFC/PATCH 08/15] kvm-s390: intercepts for privileged instructions Carsten Otte
2008-03-20 16:25 ` [RFC/PATCH 09/15] kvm-s390: interprocessor communication via sigp Carsten Otte
2008-03-20 16:25 ` [RFC/PATCH 10/15] kvm-s390: intercepts for diagnose instructions Carsten Otte
2008-03-20 16:25 ` [RFC/PATCH 11/15] kvm-s390: add kvm to kconfig on s390 Carsten Otte
2008-03-20 16:25 ` [RFC/PATCH 12/15] kvm-s390: API documentation Carsten Otte
2008-03-20 17:22   ` Randy Dunlap
2008-03-21 10:33     ` [kvm-devel] " Carsten Otte
2008-03-20 16:25 ` [RFC/PATCH 13/15] kvm-s390: update maintainers Carsten Otte
2008-03-20 16:25 ` [RFC/PATCH 14/15] guest: detect when running on kvm Carsten Otte
2008-03-20 17:16   ` Randy Dunlap
2008-03-20 17:27     ` Carsten Otte
2008-03-20 17:53   ` Christoph Hellwig
2008-03-20 20:37     ` Carsten Otte
2008-03-20 19:41       ` Christoph Hellwig
2008-03-20 20:59         ` Carsten Otte
2008-03-20 21:22           ` Heiko Carstens
2008-03-21 11:12             ` Carsten Otte
2008-03-21 14:06               ` Heiko Carstens
2008-03-21 14:33                 ` Carsten Otte
2008-03-22 17:25                   ` Heiko Carstens
2008-03-20 16:25 ` [RFC/PATCH 15/15] guest: virtio device support, and kvm hypercalls Carsten Otte
2008-03-21  0:24   ` Rusty Russell [this message]
2008-03-21  7:12     ` Carsten Otte
2008-03-21  8:15     ` Christian Borntraeger
2008-03-21 23:30       ` Rusty Russell
2008-03-22  7:36         ` Carsten Otte
2008-03-21 10:44   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803211124.49829.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=EHRHARDT@de.ibm.com \
    --cc=arnd@arndb.de \
    --cc=avi@qumranet.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cotte@de.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hollisb@us.ibm.com \
    --cc=jblunck@suse.de \
    --cc=jeroney@us.ibm.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=os@de.ibm.com \
    --cc=rvdheij@gmail.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xiantao.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox