From nobody Sun Nov 24 13:45:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1722948814; cv=none; d=zohomail.com; s=zohoarc; b=hIIHkxo8h72U2h3yH1ieJtiqDjroVhYn2lEsG3aB8KEt/IWUzIs2fat2MXjYP6YF8Q2dvzrKXRUhL6Tl/6hFvDs07WKir6l/YCj9hv0iwwDjoxRATExJyYce9npOn3nTsjyNrSsoERemorL9i57i1I3oFl0bIiUEX8FQx4hQ8SA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722948814; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5mKdPYX00cysnIaHHc614x0QrHflyLw6OzvKS8k0g7I=; b=KyIon1zQzGyqzs2jE+QI0GHeza4wVk0IQZKp/FV0b794qyI7gSIXr28+J8jMnpAzksXb7DXVVOoxYfXRAY9DqunLb5UphhOCJzyrd1CttBxjxsYomh3CB+09AjL8yieCmmsSZsevo5VGxRLzCnoaVC8BEIyRufBuq+a/Mer2giQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722948814117415.9696982643237; Tue, 6 Aug 2024 05:53:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbJgQ-000803-6E; Tue, 06 Aug 2024 08:52:58 -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 1sbJgL-0007ZC-QX for qemu-devel@nongnu.org; Tue, 06 Aug 2024 08:52:53 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbJgJ-0008TG-8y for qemu-devel@nongnu.org; Tue, 06 Aug 2024 08:52:52 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5afa207b8bfso557259a12.0 for ; Tue, 06 Aug 2024 05:52:50 -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 4fb4d7f45d1cf-5b83b82c068sm5896520a12.60.2024.08.06.05.52.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 06 Aug 2024 05:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722948769; x=1723553569; 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=5mKdPYX00cysnIaHHc614x0QrHflyLw6OzvKS8k0g7I=; b=rXhG4b4/uKpFn6/cxsG/DZb34p7J5FqOaBSnmWqczCCZSPhdexW36i0/Syu+g2/zj2 qZfcUQGH9kTdiNV/4l1w4ZNKnY9vulYdGXvM8DVNmWYHyL4jLe+1XcTwwwpRGNpH+7w5 CJVy0LG6Lin5RqqYGqkOCA4WeJVEhOqNOZE+xcwDXqjGLJxDgRvI0yICYwLTK4djXTKr Yf/1B1VP+Uo+Nb+InCuGfeOlP1/XPK1l0TK8RHgt9+Z0RHTE3pADw1AORHScTxx1qzEW Pw9tztTIo47hrLnPIgFBvfVhYQj9bhBXsNWngh+kvNeBh+QjKVXoMyYADVg0ib5vaA95 bNLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722948769; x=1723553569; 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=5mKdPYX00cysnIaHHc614x0QrHflyLw6OzvKS8k0g7I=; b=JXUcoKadFSke+j5JlfDv/3eL37B/RcrtMFOz+pd8ONHM6H+L9MfxuDql5EopDk2FIN mpOLc6IUHOcI4aymf0aSxyp4yWtf/6fTuWoQE5/eD1ZDa6ysRUeeiUjY1CCMiFMBRXb2 ATzh7jq7e/mUotg8u0Q26X1ucP33NCeGvRUVe5YvbpGK+ztSARioQE7u56N2VqC3CrhM qvn/ap4YddLRXa/4cvM043Zyyb7ZYiWlRQjIVSd77+CIu7p0ao0ZTmH6Fqr47xIk0YuE LW8KtfIKHu0pFXV/xfKbA7CYusG6+7NA9vFN6UBGoDPoQygTf4ZrzWu15603Of62hpD6 AfVQ== X-Gm-Message-State: AOJu0YzUmRl9RT4PMb3JccDO/8i8ZSOlFdS9i6eUTZjhNGfjC83KggCJ BvbqsLHtAeqGuvq7qEbsg+/Wcqzp8SS9zJwq2V8FSzowlMf6ELbyJc6Ugo4AasyXR2BlRx2nrfE E X-Google-Smtp-Source: AGHT+IG2iXGLH7xg5xXZO0cJfqpcejKmxTSK5PCb8+BH4F/+U0VgtzAxSioxsrDQHLZScrfUb3EOaA== X-Received: by 2002:a05:6402:129a:b0:57d:72e:5b3a with SMTP id 4fb4d7f45d1cf-5b7f56fb7cbmr9883959a12.33.1722948769369; Tue, 06 Aug 2024 05:52:49 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bibo Mao , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Song Gao , Richard Henderson , Jiaxun Yang Subject: [PULL 08/28] hw/intc/loongson_ipi: Add LoongsonIPICommonClass::get_iocsr_as handler Date: Tue, 6 Aug 2024 14:51:36 +0200 Message-ID: <20240806125157.91185-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806125157.91185-1-philmd@linaro.org> References: <20240806125157.91185-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1722948815450116600 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=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 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: <20240805180622.21001-9-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/loongs= on_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 { =20 struct LoongsonIPICommonClass { SysBusDeviceClass parent_class; + + AddressSpace *(*get_iocsr_as)(CPUState *cpu); }; =20 /* 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 *opaqu= e, hwaddr addr, return loongson_ipi_core_readl(s, addr, data, size, attrs); } =20 -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 =20 static MemTxResult send_ipi_data(LoongsonIPICommonState *ipi, CPUState *cp= u, uint64_t val, hwaddr addr, MemTxAttrs att= rs) { + LoongsonIPICommonClass *licc =3D LOONGSON_IPI_COMMON_GET_CLASS(ipi); int i, mask =3D 0, data =3D 0; - AddressSpace *iocsr_as =3D get_cpu_iocsr_as(cpu); + AddressSpace *iocsr_as =3D licc->get_iocsr_as(cpu); =20 if (!iocsr_as) { return MEMTX_DECODE_ERROR; @@ -354,11 +360,13 @@ static void loongson_ipi_class_init(ObjectClass *klas= s, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); LoongsonIPIClass *lic =3D LOONGSON_IPI_CLASS(klass); + LoongsonIPICommonClass *licc =3D LOONGSON_IPI_COMMON_CLASS(klass); =20 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 =3D get_iocsr_as; } =20 static const TypeInfo loongson_ipi_types[] =3D { --=20 2.45.2