From patchwork Tue Jun 2 16:33:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 49418 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AD8A620BD1 for ; Tue, 2 Jun 2015 16:39:08 +0000 (UTC) Received: by lbbqq2 with SMTP id qq2sf43356663lbb.0 for ; Tue, 02 Jun 2015 09:39:07 -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:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=Gag5hfz8NMhu3wutzh7fbH5SquJWR0KN2a+JkOIoGmU=; b=R+B3++TK4al80xUpMgQ7bxaqFDXT+/KNmamPhh50FHcpSC1+4c4fvGe/zSUZg0I8jo hWnxw5Xv0y0WwDxNOhK06pg1oRC1zZusXbAqkMI2vYpKy5+sYGujfg7fcC+/+ECuHys0 7lR9FdRPin1qVXfO/bEnsyY9Y9gGdBuKJC3Wv9GHXu8XQOcZwh694HBuA9kezpolOJ6T Wuc8d82jH4LYtqz1DGjNrnsQ323Ff3ilxNwHd1mswiwKJKkRxxQBB3CDpu05lg4LgPmv 43yfiXvtlwCjf1vd5Isv0zgBiMdEBLRqTsUA56D0qgv6Bz5TO99G9K4yx/0qZJa7DIS/ PS8Q== X-Gm-Message-State: ALoCoQnfI7p3l1PvC6sZ+eRftwxxeoT59qqLosc/teMxpVP64ywKUs/KZ3IE189FMdtbVGMkbuuw X-Received: by 10.194.5.229 with SMTP id v5mr26521132wjv.0.1433263147594; Tue, 02 Jun 2015 09:39:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.245.43 with SMTP id xl11ls614146lac.21.gmail; Tue, 02 Jun 2015 09:39:07 -0700 (PDT) X-Received: by 10.112.188.194 with SMTP id gc2mr27175683lbc.25.1433263147434; Tue, 02 Jun 2015 09:39:07 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id 8si15504566lan.120.2015.06.02.09.39.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jun 2015 09:39:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by labpy14 with SMTP id py14so118265929lab.0 for ; Tue, 02 Jun 2015 09:39:07 -0700 (PDT) X-Received: by 10.152.37.228 with SMTP id b4mr4764701lak.117.1433263147284; Tue, 02 Jun 2015 09:39:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp3200942lbb; Tue, 2 Jun 2015 09:39:06 -0700 (PDT) X-Received: by 10.55.22.28 with SMTP id g28mr47567121qkh.66.1433263146052; Tue, 02 Jun 2015 09:39:06 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z105si16271112qgz.67.2015.06.02.09.39.05 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 02 Jun 2015 09:39:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:59774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzpDV-0001ok-62 for patch@linaro.org; Tue, 02 Jun 2015 12:39:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzp8Y-0001lv-Ql for qemu-devel@nongnu.org; Tue, 02 Jun 2015 12:34:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yzp8X-0000u1-3k for qemu-devel@nongnu.org; Tue, 02 Jun 2015 12:33:58 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzp8W-0000r2-Tm for qemu-devel@nongnu.org; Tue, 02 Jun 2015 12:33:57 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Yzp8T-00031k-Gz for qemu-devel@nongnu.org; Tue, 02 Jun 2015 17:33:53 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 2 Jun 2015 17:33:46 +0100 Message-Id: <1433262832-11527-17-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1433262832-11527-1-git-send-email-peter.maydell@linaro.org> References: <1433262832-11527-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 16/22] kvm: introduce kvm_arch_msi_data_to_gsi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@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.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Eric Auger 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 Acked-by: Cornelia Huck Signed-off-by: Peter Maydell --- 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 4878959..f459fbd 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -287,6 +287,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 17a3771..b2b1bc3 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 16abbf1..548bfd7 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -600,3 +600,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 a26d25a..ca2da84 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -2766,3 +2766,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 59eb111..948619f 100644 --- a/target-mips/kvm.c +++ b/target-mips/kvm.c @@ -696,3 +696,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 1da9ea8..8f7cee5 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -2410,3 +2410,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 6de7759..2740ec4 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -2216,3 +2216,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(); +}