From patchwork Mon Jan 21 00:06:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 2008921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 15AC4DF264 for ; Mon, 21 Jan 2013 00:09:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tx4uG-00076g-GX; Mon, 21 Jan 2013 00:06:32 +0000 Received: from mail-ie0-f177.google.com ([209.85.223.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tx4u8-00075y-69 for linux-arm-kernel@lists.infradead.org; Mon, 21 Jan 2013 00:06:30 +0000 Received: by mail-ie0-f177.google.com with SMTP id k13so8995064iea.36 for ; Sun, 20 Jan 2013 16:06:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:x-originating-ip:in-reply-to:references :date:message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=zKQsJimh6B0WZbsggmPgaOies2GriHhwB8fj1Hk8gpE=; b=WbxfXgRPvQKRqBUbIDdWa+vUO4xaQnHmM+sVB5orw5KcPuUhZDwznpdU2BzgM/CrWE 0nEXx0QZujIhWw7ZWgYwBqiyw63YNeD8NxLNQDCAungFRKBCrCSajV5ICPCxoP24bSJY d+tjeguty+h3h7z4PFzID3cnLUEJdFvZSfuwRePNmp1U9UlfkFCl46xr6JOzpBNWJUL6 pFjKcr9obCOvjZ1PicnZHJBkEAbs0LpreQW25P3tt8mO4awMFcwsc7iRtUQXpIre61tm VxT9Yd8XuL/ZfK23kniiSTdtTiuOS1RZWopnCp7g0oCgDohtOBXv8hu+tXHfkVQS4wlX sl/g== MIME-Version: 1.0 X-Received: by 10.50.57.225 with SMTP id l1mr7473306igq.37.1358726773718; Sun, 20 Jan 2013 16:06:13 -0800 (PST) Received: by 10.64.37.70 with HTTP; Sun, 20 Jan 2013 16:06:13 -0800 (PST) X-Originating-IP: [72.80.83.148] In-Reply-To: References: <20130116180013.29393.49165.stgit@ubuntu> <20130116180028.29393.62418.stgit@ubuntu> Date: Sun, 20 Jan 2013 19:06:13 -0500 Message-ID: Subject: Re: [kvmarm] [PATCH v6 02/13] KVM: ARM: Introduce KVM_SET_DEVICE_ADDRESS ioctl From: Christoffer Dall To: Peter Maydell X-Gm-Message-State: ALoCoQk+TU4gAYtyT2Mqo3EQaLlnUfPE0gURa5DkdjTjg+VJ5ueJos4afjmp8Z+ZWf77GQ9mX2CR X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130120_190624_269325_F8F29B3D X-CRM114-Status: GOOD ( 16.48 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.223.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Will Deacon , linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Sun, Jan 20, 2013 at 6:22 PM, Christoffer Dall wrote: > On Thu, Jan 17, 2013 at 12:37 PM, Peter Maydell > wrote: >> On 16 January 2013 18:00, Christoffer Dall >> wrote: >>> KVM: ARM: Introduce KVM_SET_DEVICE_ADDRESS ioctl >> >> Patch subject needs updating with new name of this ioctl >> (KVM_ARM_SET_DEVICE_ADDR)... >> >>> On ARM (and possibly other architectures) some bits are specific to the >>> model being emulated for the guest and user space needs a way to tell >>> the kernel about those bits. An example is mmio device base addresses, >>> where KVM must know the base address for a given device to properly >>> emulate mmio accesses within a certain address range or directly map a >>> device with virtualiation extensions into the guest address space. >> >> "virtualization", while I'm here. >> >>> --- a/arch/arm/include/uapi/asm/kvm.h >>> +++ b/arch/arm/include/uapi/asm/kvm.h >>> @@ -65,6 +65,19 @@ struct kvm_regs { >>> #define KVM_ARM_TARGET_CORTEX_A15 0 >>> #define KVM_ARM_NUM_TARGETS 1 >>> >>> +/* KVM_SET_DEVICE_ADDRESS ioctl id encoding */ >>> +#define KVM_DEVICE_TYPE_SHIFT 0 >>> +#define KVM_DEVICE_TYPE_MASK (0xffff << KVM_DEVICE_TYPE_SHIFT) >>> +#define KVM_DEVICE_ID_SHIFT 16 >>> +#define KVM_DEVICE_ID_MASK (0xffff << KVM_DEVICE_ID_SHIFT) >> >> ...and this comment and I guess these constant names presumably >> should have "ARM" in them? >> >>> +/* Available with KVM_CAP_SET_DEVICE_ADDR */ >> >> KVM_CAP_ARM_SET_DEVICE_ADDR. >> > right, thanks: > > commit 92c7530ddee0d1e1a0b5c3fbd01aa05457812030 > Author: Christoffer Dall > Date: Sun Jan 20 18:20:52 2013 -0500 > > KVM: ARM: Update comments and defines for KVM_ARM_SET_DEVICE_ADDR > > Update comments and defines to reflect the name change of > KVM_SET_DEVICE_ADDRESS to KVM_ARM_SET_DEVICE_ADDR. > > Signed-off-by: Christoffer Dall > > diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h > index 236f528..023bfeb 100644 > --- a/arch/arm/include/uapi/asm/kvm.h > +++ b/arch/arm/include/uapi/asm/kvm.h > @@ -65,11 +65,11 @@ struct kvm_regs { > #define KVM_ARM_TARGET_CORTEX_A15 0 > #define KVM_ARM_NUM_TARGETS 1 > > -/* KVM_SET_DEVICE_ADDRESS ioctl id encoding */ > -#define KVM_DEVICE_TYPE_SHIFT 0 > -#define KVM_DEVICE_TYPE_MASK (0xffff << KVM_DEVICE_TYPE_SHIFT) > -#define KVM_DEVICE_ID_SHIFT 16 > -#define KVM_DEVICE_ID_MASK (0xffff << KVM_DEVICE_ID_SHIFT) > +/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ > +#define KVM_ARM_DEVICE_TYPE_SHIFT 0 > +#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT) > +#define KVM_ARM_DEVICE_ID_SHIFT 16 > +#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT) > > /* Supported device IDs */ > #define KVM_ARM_DEVICE_VGIC_V2 0 > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h > index 9ff7f70..33887e7 100644 > --- a/include/uapi/linux/kvm.h > +++ b/include/uapi/linux/kvm.h > @@ -875,7 +875,7 @@ struct kvm_s390_ucas_mapping { > #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) > /* Available with KVM_CAP_PPC_HTAB_FD */ > #define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd) > -/* Available with KVM_CAP_SET_DEVICE_ADDR */ > +/* Available with KVM_CAP_ARM_SET_DEVICE_ADDR */ > #define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct > kvm_arm_device_addr) > > /* > -- and this: --- -Christoffer diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index a67392a..134df21 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -924,8 +924,10 @@ static int kvm_vm_ioctl_set_device_addr(struct kvm *kvm, { unsigned long dev_id, type; - dev_id = (dev_addr->id & KVM_DEVICE_ID_MASK) >> KVM_DEVICE_ID_SHIFT; - type = (dev_addr->id & KVM_DEVICE_TYPE_MASK) >> KVM_DEVICE_TYPE_SHIFT; + dev_id = (dev_addr->id & KVM_ARM_DEVICE_ID_MASK) >> + KVM_ARM_DEVICE_ID_SHIFT; + type = (dev_addr->id & KVM_ARM_DEVICE_TYPE_MASK) >> + KVM_ARM_DEVICE_TYPE_SHIFT; switch (dev_id) { case KVM_ARM_DEVICE_VGIC_V2: