From patchwork Thu Jul 18 08:38:34 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: 813143 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp188914wro; Thu, 18 Jul 2024 01:41:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUPL6Gr8NdK4KHYYaHlTyjsufj5cHWSXDYziTUM1KNBnTVvv7CfhiBvS7irCKi9GZz1cRCWvgycOSDHlWKbaaHu X-Google-Smtp-Source: AGHT+IGC2RsVMfMDykEYsRe0dzLCb3bZjP4FIYvZJ+g+ygU3K75afjJTuuIme7iX+41Kov25kLMB X-Received: by 2002:a05:620a:1729:b0:79f:14de:2a2a with SMTP id af79cd13be357-7a18746e0d3mr545389885a.37.1721292063904; Thu, 18 Jul 2024 01:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721292063; cv=none; d=google.com; s=arc-20160816; b=gItuuJzp8hvw49rLSVyATgy1kLtdyeDbgOpuGht63jxP6AnfKPH+aOHxlfFW8z0sVB FO8ImKKeftxdOU+AOdaCCFhmyjxojxvGzfVupDzjwBHVREAqzwACmu+UinnokwsqIYeI PblTxbiXVprNF2EQ9Kcq8TU6OVEzTdSYh0jp2QkTzl6/N58/WHh9WBLYX9UckCJn7Q1K ltYjGi5J/i/RtC044m/nK/sF70RdL/32x+b8kPpoiR5vbFQDdRBNlW/CKU4PLxpwo1HU Y/xBbXkI3UTpatZ4wAujiKE4nLagCVg5MP3I5HksWyY5htI3rfxjuOJhszj0zpaNKzR0 wdAQ== 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=vcjSxPAzKxhH+dpnOyTqicwIlTcohXs+GfUPxVSqVy8=; fh=NLZWUfvz+g+MnoIWE6nGov3chqHrPo6wetxAC/CDqtI=; b=MSsr6hr0jmrEZFPp5ACBN4IHlCY60IXDRiJAxUEbgJSsplfya7sVd9r2zCdxdD8htO LeDneimzg7H55zqapmVLZ9PZmkSu9wKbiUrLT+YAEgBryHT5n1DKrzoNXCsjFGmV7aMj jSddJPcbx5SdE59naytyy+h9egUj7EQzetr+fELlh+bw9h8dVlsqAJn1EVRnYmvLx/iK BFUrDM4IsYX2nHsfRVJxvJuTp9Z2P1i+xeedGJhY8pVe+e6h0wMvHpVlPs+8ErWAv02t jX0k0EjMMUAaQk2sQSm4oiKwkUgI4GURYoTL87XPVzS7U+gZ0FrM0JSfTzPTVLMWWOA9 tWIg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xWFQrn2Z; 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 af79cd13be357-7a193990676si8052585a.496.2024.07.18.01.41.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jul 2024 01:41:03 -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=xWFQrn2Z; 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 1sUMgX-0007m4-Cy; Thu, 18 Jul 2024 04:40: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 1sUMgJ-0006xW-5i for qemu-devel@nongnu.org; Thu, 18 Jul 2024 04:40:08 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sUMgH-0004v4-7c for qemu-devel@nongnu.org; Thu, 18 Jul 2024 04:40:06 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-36798ea618bso314414f8f.0 for ; Thu, 18 Jul 2024 01:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721292003; x=1721896803; 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=vcjSxPAzKxhH+dpnOyTqicwIlTcohXs+GfUPxVSqVy8=; b=xWFQrn2ZO/VnM5Lz1Ld/Z1fKxpdvtWj1fugBcoKaALj1hF0ClfiZO5pA9chSJbE18B cFzuvWjh5iKOP6j/gUzQTcsvjdk3pAy1ualvU7poiyN47zrXR5xQATjhuHjHpuyI0giu WBhEULfkARknpL4O98VnCRwFo0oqd2fLmTEKsLuddxs/2pOlYFOzHKgd+x+jIegcPLzi /mtm4iUhQ5SmiIsitNfpwRDIh85lp/Cb1qObfLPrV/cWdmgvDhCOs+AdOcDG/na6w2Va gK2WhDmPLCduZR26UjwzWuOtYocetpWikHdarl0W6Lkwc3aFNj1gIrd+UQBb26HQt40r c+SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721292003; x=1721896803; 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=vcjSxPAzKxhH+dpnOyTqicwIlTcohXs+GfUPxVSqVy8=; b=wNFK9MlEkODbY1nyQHP2RthJD/9t5s1/6NhjZKZBqX4GEg0nYTXo9+dgSAXKnZ7aoH Fvy3hkJSoE2KYyGnaPFkoxYI2XmcaNQqOMdnIGRNrg38LE2nlN2wxnjWynS1SjRXPu5G lNDEtoeEym0juKTuygjzIgnzFq0yoLLkjel2XZlzQQU0wQy8HxQm9SPwdA4s57+UKmO6 xO1SNdVWndwoFqB+VPPhz/dmitGByKT6CBdglCjv9eixVgmKjdSyHX14A/UOrU9luMSR cfPWep/2GwdBq64wskZ4MKFsF40Y7UdeGWiIlzyfiENCq89ymV34LYjmh1FohNeP+9o1 kjIw== X-Gm-Message-State: AOJu0YytpxkdN37ZJlR4j9lRt7MhpBMIPVkujyWvfmL0r7O1gPlehVIe EVznkmvl7cpnBz+AOq4UQcI7UNCtRry2TKQrNMyJ+KO/v9cBA/8cFCaC6dhscto2h1mPPJF3o4v K0/c= X-Received: by 2002:adf:9b86:0:b0:368:3f6a:1dec with SMTP id ffacd0b85a97d-3683f6a1fc2mr2024381f8f.9.1721292003209; Thu, 18 Jul 2024 01:40:03 -0700 (PDT) Received: from localhost.localdomain ([176.187.208.21]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680daccad8sm13651982f8f.60.2024.07.18.01.40.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 18 Jul 2024 01:40:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao , Jiaxun Yang Cc: Song Gao , Xianglai Li , Huacai Chen , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Xiaojuan Yang , Paolo Bonzini Subject: [PATCH v4 10/18] hw/intc/loongson_ipi: Pass LoongsonIPICommonState to send_ipi_data() Date: Thu, 18 Jul 2024 10:38:34 +0200 Message-ID: <20240718083842.81199-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240718083842.81199-1-philmd@linaro.org> References: <20240718083842.81199-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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 In order to get LoongsonIPICommonClass in send_ipi_data() in the next commit, propagate LoongsonIPICommonState. 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 Reviewed-by: Richard Henderson --- hw/intc/loongson_ipi.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index f3d1f031bc..a54db87638 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -88,8 +88,8 @@ static AddressSpace *get_cpu_iocsr_as(CPUState *cpu) return NULL; } -static MemTxResult send_ipi_data(CPUState *cpu, uint64_t val, hwaddr addr, - MemTxAttrs attrs) +static MemTxResult send_ipi_data(LoongsonIPICommonState *ipi, CPUState *cpu, + uint64_t val, hwaddr addr, MemTxAttrs attrs) { int i, mask = 0, data = 0; AddressSpace *iocsr_as = get_cpu_iocsr_as(cpu); @@ -119,7 +119,8 @@ static MemTxResult send_ipi_data(CPUState *cpu, uint64_t val, hwaddr addr, return MEMTX_OK; } -static MemTxResult mail_send(uint64_t val, MemTxAttrs attrs) +static MemTxResult mail_send(LoongsonIPICommonState *ipi, + uint64_t val, MemTxAttrs attrs) { uint32_t cpuid; hwaddr addr; @@ -134,10 +135,11 @@ static MemTxResult mail_send(uint64_t val, MemTxAttrs attrs) /* override requester_id */ addr = SMP_IPI_MAILBOX + CORE_BUF_20 + (val & 0x1c); attrs.requester_id = cs->cpu_index; - return send_ipi_data(cs, val, addr, attrs); + return send_ipi_data(ipi, cs, val, addr, attrs); } -static MemTxResult any_send(uint64_t val, MemTxAttrs attrs) +static MemTxResult any_send(LoongsonIPICommonState *ipi, + uint64_t val, MemTxAttrs attrs) { uint32_t cpuid; hwaddr addr; @@ -152,7 +154,7 @@ static MemTxResult any_send(uint64_t val, MemTxAttrs attrs) /* override requester_id */ addr = val & 0xffff; attrs.requester_id = cs->cpu_index; - return send_ipi_data(cs, val, addr, attrs); + return send_ipi_data(ipi, cs, val, addr, attrs); } static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, @@ -249,15 +251,16 @@ static const MemoryRegionOps loongson_ipi_iocsr_ops = { static MemTxResult loongson_ipi_writeq(void *opaque, hwaddr addr, uint64_t val, unsigned size, MemTxAttrs attrs) { + LoongsonIPICommonState *ipi = opaque; MemTxResult ret = MEMTX_OK; addr &= 0xfff; switch (addr) { case MAIL_SEND_OFFSET: - ret = mail_send(val, attrs); + ret = mail_send(ipi, val, attrs); break; case ANY_SEND_OFFSET: - ret = any_send(val, attrs); + ret = any_send(ipi, val, attrs); break; default: break;