From patchwork Tue Sep 15 03:11:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haibo Xu X-Patchwork-Id: 303965 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp2156792ilg; Mon, 14 Sep 2020 20:14:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYWWUUmEEnAl0N9e/msat5QPiwP+Vpvtgk/RfD0mUDp6S/OBBpqQDWih+V6QLjCFRBZNp0 X-Received: by 2002:a5b:bd0:: with SMTP id c16mr5259272ybr.290.1600139688585; Mon, 14 Sep 2020 20:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600139688; cv=none; d=google.com; s=arc-20160816; b=H2d9HNYINMDk991gdeSh7bEUdZj8yGBhFclZEo3nijo1BhZR6RQy9ofBGJG7ZslrLZ /naiUaARwSHe570SRTKnaagk3sDq/fmXp680mJCm2I895rsVcGkH6msE3oDYzJtmsnSl pNzDKJ1OnJ5zEfTh9MBarKwH+Th4vSYcfqJOZ6C69Ddxy7wGRMtrJcMLqGgxCONrjoJb iUDV1Zu2Pv2RQH7OgXOYM1Qc818UN7dyWFS8qmd16nm1rGMrpSENGpc10qkigvT7hMTV cfw7bxMUjPQnFRkc53W5P09VvfToenPE86uOc1w+3EJhXsHlJSF6VDTRWGqmUB/R3Qd0 gf4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=W+V3obnXTS2moUn5807WDrMB34yhPyYZkE7Y60hl+S0=; b=Wcb8IKyMbXI+pIVme8dHCJ1Bfd6FhfRfVK+0i04A/VUkqxJ9F5ipnCOnGzdvYjh5Rc bvHaym+4MfuwjaWOHqpNgpGUKIK2PW/vpjLFPzjF4+uufXcFxv62ezIITJnuVTVtVeDg 3smY3azGDJin+CYhZfN3JxFiyo2YsVVQBno6Ur1jJ/sgEaXy5M/hTbVrmstWmEzfMfDM Y1w6RiHhTgP/RvPlMh6+cmaRn8yDYqmyW9qaRuWUZAGTkTOjylYmjBqnEPPy2f2zqB9b a3zy6uY+8OBS82q+GC0cviB6XMg1dn5WIlR31h/q1IPKwSa9wCDCWm/N1kWarD/7A9tb NxQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ifSRseTT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b200si2346779ybg.65.2020.09.14.20.14.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Sep 2020 20:14:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ifSRseTT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kI1Qe-0004ZA-3P for patch@linaro.org; Mon, 14 Sep 2020 23:14:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kI1OA-0000L2-FV for qemu-devel@nongnu.org; Mon, 14 Sep 2020 23:12:14 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:35145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kI1O8-0001iZ-M5 for qemu-devel@nongnu.org; Mon, 14 Sep 2020 23:12:14 -0400 Received: by mail-pf1-x442.google.com with SMTP id o68so1134737pfg.2 for ; Mon, 14 Sep 2020 20:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W+V3obnXTS2moUn5807WDrMB34yhPyYZkE7Y60hl+S0=; b=ifSRseTT+IWW7cF7o8md//hp9KC4y2VFoKEda5+zNgS5OgbVUI75l1wLZoBfX7lPOJ xSWO6wfLFj9roXdVz4Fzbh1tXGv3Yu97dDQqO7I8lINsz9U7zrf/Tao+OvLzQXUITarS /4lbI5seL2WtvSMwZy1dWTcNsPAbrXU7toSnJWlYPLALgQGBH2S9d2tZOBQXroOVxe4U 4HJAdOIXQN95zsyzKgcUbVJFIa4RkG1H650i0LxCzT+5pxrXG5vH0ZgNcZgk9oZg7NGv fwuZGfcme0iIYTRUh1uCvE3uLTC7jsWFnGlt6GErb/4YsNdNkroZgxiYqxXVySIi+1HK paKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W+V3obnXTS2moUn5807WDrMB34yhPyYZkE7Y60hl+S0=; b=VnYhD2+Ly/6wrZdVynBmbBw79xPbTE+zTxaxTrgYx9iVKZqFfJ0ZAZzcHAMgHwuLPm XcTSBTMhwVWq66v4XXhzmmWQ8/lZ44XS5cF/maYwEqNM95zL3S2w23ZyCbirado6TE31 tRZEWj1qE3ysz42u0f6AhpAnXSeHMeqhDTjLFrSirSkFKqBG+O2gOeq7ymabYhXpv1nD opanjEm7QuHAU8os6mwzZiuGX/QU1gC+ZV6OyhcjK6PwOeziKnkzSvSTbmvAIpnBJKat 9821EQoHBbBpESuQxaLXdPGZO6smw2kq5sv0MSAQblig5PDhIQCM9ObnstOnQ7431Xv8 nk6A== X-Gm-Message-State: AOAM530egDuRSy7eYxbtkxqHiNNYHomTrDblbS2hGb2+zluQvTK2mLnq Epxg7Y46FIz6W6qiJU/PZY2o X-Received: by 2002:aa7:92c8:0:b029:13e:d13d:a12b with SMTP id k8-20020aa792c80000b029013ed13da12bmr16460143pfa.19.1600139531540; Mon, 14 Sep 2020 20:12:11 -0700 (PDT) Received: from localhost.localdomain ([147.75.106.138]) by smtp.gmail.com with ESMTPSA id g23sm11551776pfh.133.2020.09.14.20.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 20:12:11 -0700 (PDT) From: Haibo Xu To: drjones@redhat.com, richard.henderson@linaro.org Subject: [PATCH v3 06/12] target/arm/kvm: spe: Add device init and set_irq operations Date: Tue, 15 Sep 2020 03:11:42 +0000 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::442; envelope-from=haibo.xu@linaro.org; helo=mail-pf1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, philmd@redhat.com, qemu-devel@nongnu.org, Haibo Xu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Andrew Jones Signed-off-by: Haibo Xu --- target/arm/kvm64.c | 33 +++++++++++++++++++++++++++++++++ target/arm/kvm_arm.h | 5 +++++ 2 files changed, 38 insertions(+) -- 2.17.1 diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 8ffd31ffdf..5a2032fc9e 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -450,6 +450,39 @@ void kvm_arm_pmu_set_irq(CPUState *cs, int irq) } } +void kvm_arm_spe_init(CPUState *cs) +{ + struct kvm_device_attr attr = { + .group = KVM_ARM_VCPU_SPE_V1_CTRL, + .attr = KVM_ARM_VCPU_SPE_V1_INIT, + }; + + if (!ARM_CPU(cs)->has_spe) { + return; + } + if (!kvm_arm_set_device_attr(cs, &attr, "SPE")) { + error_report("failed to init SPE"); + abort(); + } +} + +void kvm_arm_spe_set_irq(CPUState *cs, int irq) +{ + struct kvm_device_attr attr = { + .group = KVM_ARM_VCPU_SPE_V1_CTRL, + .addr = (intptr_t)&irq, + .attr = KVM_ARM_VCPU_SPE_V1_IRQ, + }; + + if (!ARM_CPU(cs)->has_spe) { + return; + } + if (!kvm_arm_set_device_attr(cs, &attr, "SPE")) { + error_report("failed to set irq for SPE"); + abort(); + } +} + static int read_sys_reg32(int fd, uint32_t *pret, uint64_t id) { uint64_t ret; diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index f79655674e..bb155322eb 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -348,6 +348,8 @@ int kvm_arm_vgic_probe(void); void kvm_arm_pmu_set_irq(CPUState *cs, int irq); void kvm_arm_pmu_init(CPUState *cs); +void kvm_arm_spe_set_irq(CPUState *cs, int irq); +void kvm_arm_spe_init(CPUState *cs); int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level); #else @@ -397,6 +399,9 @@ static inline int kvm_arm_vgic_probe(void) static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq) {} static inline void kvm_arm_pmu_init(CPUState *cs) {} +static inline void kvm_arm_spe_set_irq(CPUState *cs, int irq) {} +static inline void kvm_arm_spe_init(CPUState *cs) {} + static inline void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) {} static inline void kvm_arm_get_virtual_time(CPUState *cs) {}