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: 2008911 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 60C1BDF264 for ; Mon, 21 Jan 2013 00:06:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752608Ab3AUAGP (ORCPT ); Sun, 20 Jan 2013 19:06:15 -0500 Received: from mail-ia0-f178.google.com ([209.85.210.178]:61297 "EHLO mail-ia0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752509Ab3AUAGO (ORCPT ); Sun, 20 Jan 2013 19:06:14 -0500 Received: by mail-ia0-f178.google.com with SMTP id y26so2370108iab.23 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=QrkTG+ofz3BzlSJCq93p8n75tew4SMh3PULT/L6MQ1k3lH91tuZdO1ga2ba7xmGeUz N3/8J6Ib3duDlnweA/hJa4OJfluOl/dkxB4ngrmXqEsbF/03Sb1n8mgDNzur+iQvqjDk /r19Cy+KI0BhNXotAuLIe/nMBoBqVx6Y1T/LvjJRnpjO3dkL2fA/L8jrez9MV28xctu9 8ybFGisuLpASmL84PXbiiofLeJFPebt8MQpAJvAbY4BUbJcfJaXg3TA4EbB9UNKw12oI ojoLabhD7bJ+VHVhRUjRuxc1wSK38n7NNIyYUiqJNs+aVRUNdFVGR8jOTMRC2YfXyEs6 BHRw== 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 Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, Will Deacon X-Gm-Message-State: ALoCoQllsApsflBIUpWuf6xoeuSgE7u2VdChlnYK7ZHPNbpvzNd9FT0Vvscr0YPjR92R7m95qFdE Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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: