From patchwork Thu Apr 9 15:20:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 46967 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8ED8121416 for ; Thu, 9 Apr 2015 15:20:22 +0000 (UTC) Received: by layy10 with SMTP id y10sf27814362lay.0 for ; Thu, 09 Apr 2015 08:20:21 -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=CxTjLsWAGeCkZr5FWpLvXL6/Cyrkf3xy6xl+zcaf9/4=; b=eJvXvoRz4ATkRzYYq2N4fp9bFwbM+rJfltQsKAM8cJjPIdbw7c9M5otuTTtxy3k+SG 2EVnnl9U/ueU16R9dgyX/ixkDdtadOTgOjJbjk18ANYGBrgiiSyBznIAv8wV3K/3+sAh vw1IXiE16YEr8mwfoLiIatbPARv30kV1sAd4iWQW/cRh3XC3T9bznJYOfFYbVWS2m6VY boJiZOlBX9F6YNnG4pdc3iOnXEecyxFrHnQKkAIStasaq7xvnVMib9pEkLeqxYjyyop/ tJBr+QnPWysskyuzGzxWxBOXG7h8rIHYmPcM042p2z+YNwQ4Bq0CcSIVkBom2eHs5nJQ hlnA== X-Gm-Message-State: ALoCoQmIM6u38JpKjs/GmgqKt0jNSpGUKEobM127h8J7kEaOzIp931pDZDTB7Btd6Bqw8NLMAOXo X-Received: by 10.152.20.41 with SMTP id k9mr65351lae.10.1428592821457; Thu, 09 Apr 2015 08:20:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.65 with SMTP id lu1ls304963lac.104.gmail; Thu, 09 Apr 2015 08:20:21 -0700 (PDT) X-Received: by 10.152.36.73 with SMTP id o9mr4832831laj.48.1428592821310; Thu, 09 Apr 2015 08:20:21 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id er8si11704229lbc.23.2015.04.09.08.20.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 08:20:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by labbd9 with SMTP id bd9so80701872lab.2 for ; Thu, 09 Apr 2015 08:20:20 -0700 (PDT) X-Received: by 10.112.162.232 with SMTP id yd8mr28073547lbb.41.1428592820881; Thu, 09 Apr 2015 08:20:20 -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 l1csp536433lbt; Thu, 9 Apr 2015 08:20:20 -0700 (PDT) X-Received: by 10.194.48.12 with SMTP id h12mr62763285wjn.74.1428592820143; Thu, 09 Apr 2015 08:20:20 -0700 (PDT) Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com. [74.125.82.53]) by mx.google.com with ESMTPS id fi8si12027545wib.10.2015.04.09.08.20.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 08:20:20 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.53 as permitted sender) client-ip=74.125.82.53; Received: by wgsk9 with SMTP id k9so101297242wgs.3 for ; Thu, 09 Apr 2015 08:20:19 -0700 (PDT) X-Received: by 10.180.84.67 with SMTP id w3mr7333218wiy.68.1428592819817; Thu, 09 Apr 2015 08:20:19 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id m9sm20590698wiz.24.2015.04.09.08.20.18 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Apr 2015 08:20:18 -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 1/2] kvm: introduce kvm_arch_msi_data_to_gsi Date: Thu, 9 Apr 2015 16:20:07 +0100 Message-Id: <1428592808-4424-2-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1428592808-4424-1-git-send-email-eric.auger@linaro.org> References: <1428592808-4424-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.215.46 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 --- 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..7c648e7 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) +{ + return data & 0xffff; +} diff --git a/target-mips/kvm.c b/target-mips/kvm.c index 4d1f7ea..e53e059 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) +{ + return data & 0xffff; +} 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..6509aff 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) +{ + return data & 0xffff; +}