From patchwork Fri Apr 10 07:48:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 46996 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E221B218D9 for ; Fri, 10 Apr 2015 07:48:20 +0000 (UTC) Received: by lbcne10 with SMTP id ne10sf2192632lbc.1 for ; Fri, 10 Apr 2015 00:48:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=N4b8BF7QN529gQZ3pufj/l7j8G/StC1qsvuRgpIVCLs=; b=E2os2P4DJR1Nm+1LJGHBJLhcl6nO3EQFMr/Ha8Ei8L9vCs5pqsHRAuOFgNTgBEWrWU 0V1qY2zE8/4pWGCDwEotm/1K18GY0j8Ix573U9XiW2F4LZrxEk6IFSXnj77A0yGR6M9c s9UZYFY+QAOH4crhem8xup/IxGM+hWWQ+K/BCmbJrLt0IT7/7VzA+IIAlncr82Tkk5Qt ubZjjdxMPJ66hdk6n++ibLRmTjnROqGtqPUy6RxiBMChZchxush1SEzPL5IGDsJcyPNJ H9DQd9uy4gEF4x/hMQezESVoCjRBs4pXiiGCZyp0f+MsOb87IeB0AZ/RdPHCCBWfHP6h q6oQ== X-Gm-Message-State: ALoCoQlIOVdD7hrB817wsFRqK8+BQl05xEofOSjK14haxHt6GD/jKTnuOP4FH58Mzy85uLa0hMhB X-Received: by 10.180.81.134 with SMTP id a6mr235021wiy.1.1428652099642; Fri, 10 Apr 2015 00:48:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.194 with SMTP id v2ls457401lag.59.gmail; Fri, 10 Apr 2015 00:48:19 -0700 (PDT) X-Received: by 10.152.178.133 with SMTP id cy5mr283439lac.2.1428652099422; Fri, 10 Apr 2015 00:48:19 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id mz5si844499lbb.71.2015.04.10.00.48.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Apr 2015 00:48:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbcga7 with SMTP id ga7so7687169lbc.1 for ; Fri, 10 Apr 2015 00:48:19 -0700 (PDT) X-Received: by 10.112.125.167 with SMTP id mr7mr268076lbb.106.1428652099304; Fri, 10 Apr 2015 00:48:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.67.65 with SMTP id l1csp930311lbt; Fri, 10 Apr 2015 00:48:18 -0700 (PDT) X-Received: by 10.194.175.137 with SMTP id ca9mr535472wjc.67.1428652098629; Fri, 10 Apr 2015 00:48:18 -0700 (PDT) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com. [209.85.212.179]) by mx.google.com with ESMTPS id dn3si2374510wid.77.2015.04.10.00.48.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Apr 2015 00:48:18 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.179 as permitted sender) client-ip=209.85.212.179; Received: by wiun10 with SMTP id n10so16478459wiu.1 for ; Fri, 10 Apr 2015 00:48:18 -0700 (PDT) X-Received: by 10.194.200.229 with SMTP id jv5mr564848wjc.59.1428652098398; Fri, 10 Apr 2015 00:48:18 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id df1sm5833465wib.12.2015.04.10.00.48.17 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Apr 2015 00:48:17 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, pbonzini@redhat.com, peter.maydell@linaro.org, cornelia.huck@de.ibm.com, borntraeger@de.ibm.com, agraf@suse.de, james.hogan@imgtec.com Cc: christoffer.dall@linaro.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, aik@ozlabs.ru Subject: [PATCH v2 1/2] kvm: introduce kvm_arch_msi_data_to_gsi Date: Fri, 10 Apr 2015 08:48:09 +0100 Message-Id: <1428652090-5354-2-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1428652090-5354-1-git-send-email-eric.auger@linaro.org> References: <1428652090-5354-1-git-send-email-eric.auger@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On ARM the MSI data corresponds to the shared peripheral interrupt (SPI) ID. This latter equals to the SPI index + 32. to retrieve the SPI index, matching the gsi, an architecture specific function is introduced. Signed-off-by: Eric Auger Acked-by: Christoffer Dall --- v1 -> v2: - abort on i386/mips/s390x since those archs do not support kvm_gsi_direct_mapping --- include/sysemu/kvm.h | 2 ++ kvm-all.c | 2 +- target-arm/kvm.c | 5 +++++ target-i386/kvm.c | 5 +++++ target-mips/kvm.c | 5 +++++ target-ppc/kvm.c | 5 +++++ target-s390x/kvm.c | 5 +++++ 7 files changed, 28 insertions(+), 1 deletion(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 197e6c0..ebd8b17 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -286,6 +286,8 @@ void kvm_arch_init_irq_routing(KVMState *s); int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, uint64_t address, uint32_t data); +int kvm_arch_msi_data_to_gsi(uint32_t data); + int kvm_set_irq(KVMState *s, int irq, int level); int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg); diff --git a/kvm-all.c b/kvm-all.c index dd44f8c..3e9675e 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1228,7 +1228,7 @@ int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg) int virq; if (kvm_gsi_direct_mapping()) { - return msg.data & 0xffff; + return kvm_arch_msi_data_to_gsi(msg.data); } if (!kvm_gsi_routing_enabled()) { diff --git a/target-arm/kvm.c b/target-arm/kvm.c index fdd9ba3..05d5634 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -598,3 +598,8 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, { return 0; } + +int kvm_arch_msi_data_to_gsi(uint32_t data) +{ + return (data - 32) & 0xffff; +} diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 41d09e5..a832328 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -2764,3 +2764,8 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, { return 0; } + +int kvm_arch_msi_data_to_gsi(uint32_t data) +{ + abort(); +} diff --git a/target-mips/kvm.c b/target-mips/kvm.c index 4d1f7ea..09eb8f9 100644 --- a/target-mips/kvm.c +++ b/target-mips/kvm.c @@ -694,3 +694,8 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, { return 0; } + +int kvm_arch_msi_data_to_gsi(uint32_t data) +{ + abort(); +} diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 12328a4..53569f6 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -2408,3 +2408,8 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, { return 0; } + +int kvm_arch_msi_data_to_gsi(uint32_t data) +{ + return data & 0xffff; +} diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index b48c643..5911a38 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -1940,3 +1940,8 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, route->u.adapter.adapter_id = pbdev->routes.adapter.adapter_id; return 0; } + +int kvm_arch_msi_data_to_gsi(uint32_t data) +{ + abort(); +}