From patchwork Mon Aug 5 18:06:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816739 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469780wrh; Mon, 5 Aug 2024 11:08:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUWd5X0YIxuUuE07hHqHsZmkxElwlelo+OOXEUDzhdeLIAiudRsgiUPkMG4KEtRtPNuNn5lmnrvUXoprAXYwQ8s X-Google-Smtp-Source: AGHT+IG5RjM2RxaO+KVD1mXo2xtH1iRPTMc3Oyj24wmFON65bFF154UY3NBA1VBo+0zv717Xibkj X-Received: by 2002:ac8:584e:0:b0:446:5a11:948 with SMTP id d75a77b69052e-4518921e4ecmr160700221cf.18.1722881279829; Mon, 05 Aug 2024 11:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881279; cv=none; d=google.com; s=arc-20160816; b=AgdUCD2gHAkCqu+NbCRc0PgzTnLDcAKs5lSs+mCZHJ6Raug2Ikx5HGLwjIVJRiiOOR 2MThIaSaDfNdjatL9+n835hDM8BCNqjdDGRx7/TxsGYxc24B2Sp2DpORlXJiJJYIvVp+ JvYbcC46eNKM4W1yTWBrhWQZhXFBG6kTqSOK8RTI6ZPK8NuW13S6HCKSpq6SFpSViJqi SEX2Z6utVOw1cnHrQwSy/aPAxeNsJ9RukHyc97J42fr0Nx0PMOgfm2XjVfV4c5tQfegD FXjN4/9MbnLNoiIS4ph9lAl7S8olvn4bCFPHyjYRhQrwootaGlccvwWVT13bf+Tln1mv bAIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=UhjqKVMOEvjprgDLvTe8v8tblCl0hjWaV3RiPalNFPQ=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=kCi+YndOi+dRRtdA3ZSIvp9SJDZ++moqiQ5nCeXPRDSRWqfTQRMoxTHKI+k39zz0L+ HTkoYWAtO+z83iod4SLhgth1iHhqqhsaCeUsEZt+t6ngqrKfiTq5Hg6XIeqf3bISANgs BjdwpOWfe7TZ9VBkXOrR3HOzFDqGXvNaelS6S4WRFTaP2uiHeVQmA71YgR4+4AFCCWLz ylI1LE9D/6anthscM+2qXCjJlOIesre6zB2ZzGdamUbBuSH86QWgbImKOeaUGuv466aD dIyWwCLwSZKnD6q0owKplg1DE1s7uCO3IREyAdsAVWcDP3FItBM6iu51DbxdoQ+wTbtO KheQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HK1glW2f; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4518a6be0e7si111874971cf.153.2024.08.05.11.07.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:07:59 -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=pass header.i=@linaro.org header.s=google header.b=HK1glW2f; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb279-0007ri-5a; Mon, 05 Aug 2024 14:07:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sb276-0007Z9-Gl for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:20 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb274-0006Q0-P8 for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:20 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4266f3e0df8so70848145e9.2 for ; Mon, 05 Aug 2024 11:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881237; x=1723486037; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UhjqKVMOEvjprgDLvTe8v8tblCl0hjWaV3RiPalNFPQ=; b=HK1glW2f/xpxfX6YsTS4znAtT7/MMw4Z3U49S5pDJfAqKTKAXrNlcaBLhuhdNr/4gX j3ZxIrGGvwjbQxO5OPcO/MOulKbodPD8byRS36yxxO480hf6jT+lqhs1z5/JxzsrtSa0 8kLj65catrML8E166PLlokhtHmbqVjuaSeB2k25gEuXndLOPR9fisgqVtrJawk/kHHGS FMEH/WWEx+gheNj5U+L+cVGCHA/m6kRD+16K08I2jK/MJHu2Tyfq/o4R+5eTiiFP9lwe xCwEQlTvHKEGTA+D+/qn71Wi8Xm921niD/gEuMGCJDWpKTN3oR4n+exiUHP8GFFoFRIt DfoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881237; x=1723486037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UhjqKVMOEvjprgDLvTe8v8tblCl0hjWaV3RiPalNFPQ=; b=PGaWpAiMvSQGBW5xUaN2suWLay2rrNWf0cwTto9CAJFJ74d7fkqAbAxDkfEgInEv17 QPQoK42k4Cusbe06P7rEHXAGRjNs497EvWAJIlFyKEa0eJxwuf3qszB/zqHs7D7KT47b LHm6S4OMXuN42018/g7yQPzFYNuN6CDk8/7lZWmwR7AAbalQ0hJ9I22M1Z27331xQ4Ix KIRQW2fxM7u2bEJWllRIvylmYwTFDRU1iAFE1lrnAbumjJQ9QFH+gZi8z21Udi3bC4I/ cSWEXK+HuvdchM0K3+eGxaLcqLVVw/651j5e/nTd7/sK8gEbTSmrqojvV6uMNN/aXhHm iFFA== X-Gm-Message-State: AOJu0Yy+8FN5Q3iLsfK7oJMnziMl5McOxgGOr3WU5w+8vO7/0BG8XzOT O+tjp32vrhYVvNG2LA3wH2IT0f4UxjyyYwO8uLsLfU0dvpfI5VcvnOU7jY021txeaJqwsaBPafC x X-Received: by 2002:a05:600c:4e8e:b0:426:654e:16d0 with SMTP id 5b1f17b1804b1-428e6a60397mr100328685e9.0.1722881236870; Mon, 05 Aug 2024 11:07:16 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd01efe5sm10706635f8f.46.2024.08.05.11.07.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:07:16 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 08/15] hw/intc/loongson_ipi: Add LoongsonIPICommonClass::get_iocsr_as handler Date: Mon, 5 Aug 2024 20:06:15 +0200 Message-ID: <20240805180622.21001-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com 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.29 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 From: Bibo Mao Allow Loongson IPI implementations to have their own get_iocsr_as() handler. Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-12-philmd@linaro.org> --- include/hw/intc/loongson_ipi_common.h | 2 ++ hw/intc/loongson_ipi.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h index 967c70ad1c..1a2ee41cc9 100644 --- a/include/hw/intc/loongson_ipi_common.h +++ b/include/hw/intc/loongson_ipi_common.h @@ -39,6 +39,8 @@ struct LoongsonIPICommonState { struct LoongsonIPICommonClass { SysBusDeviceClass parent_class; + + AddressSpace *(*get_iocsr_as)(CPUState *cpu); }; /* Mainy used by iocsr read and write */ diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 8bf16f26d4..eb99de9068 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -75,24 +75,30 @@ static MemTxResult loongson_ipi_iocsr_readl(void *opaque, hwaddr addr, return loongson_ipi_core_readl(s, addr, data, size, attrs); } -static AddressSpace *get_cpu_iocsr_as(CPUState *cpu) -{ #ifdef TARGET_LOONGARCH64 +static AddressSpace *get_iocsr_as(CPUState *cpu) +{ return LOONGARCH_CPU(cpu)->env.address_space_iocsr; +} #endif + #ifdef TARGET_MIPS +static AddressSpace *get_iocsr_as(CPUState *cpu) +{ if (ase_lcsr_available(&MIPS_CPU(cpu)->env)) { return &MIPS_CPU(cpu)->env.iocsr.as; } -#endif + return NULL; } +#endif static MemTxResult send_ipi_data(LoongsonIPICommonState *ipi, CPUState *cpu, uint64_t val, hwaddr addr, MemTxAttrs attrs) { + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); int i, mask = 0, data = 0; - AddressSpace *iocsr_as = get_cpu_iocsr_as(cpu); + AddressSpace *iocsr_as = licc->get_iocsr_as(cpu); if (!iocsr_as) { return MEMTX_DECODE_ERROR; @@ -354,11 +360,13 @@ static void loongson_ipi_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); LoongsonIPIClass *lic = LOONGSON_IPI_CLASS(klass); + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_CLASS(klass); device_class_set_parent_realize(dc, loongson_ipi_realize, &lic->parent_realize); device_class_set_parent_unrealize(dc, loongson_ipi_unrealize, &lic->parent_unrealize); + licc->get_iocsr_as = get_iocsr_as; } static const TypeInfo loongson_ipi_types[] = {