From nobody Mon Nov 25 10:27:48 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1716026282; cv=none; d=zohomail.com; s=zohoarc; b=Qp/1Y+NJ05dimSbPU3yBthvTyXl5GRRiZKfKhrYgIGu3kkmTFPV8M+BrwYrAchYXGH3BAON6VcWgk2+9ksna4ggR+AEcYlZp18j+FmgOvvgxJVhNSq8UkPSW+4qky9i1SzA2sd1uD69gMnTWiXPETihmIgr4pvxpy4qD4lSqukw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716026282; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=w3G0YjEj/ZtZfTFpVX30ielTug1SDL+ATHyj7RHn8kI=; b=Li3pnWvyygQjNMdPm+EwIS/rpJPZ2OrbFhUeMFlJfLqzhjzlqpfO12tI8BcB+om8BvQJXddgY+mQdZ2kdnkBC7QJH9K53lYrcKmeg5P49Us+Q+QCRO4HgmSHdapk/zBZkXVsdfhcQKbSs/6cN58GvbDLIRfufRrTIavGIHT6Ho4= 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 1716026282754370.47347238221437; Sat, 18 May 2024 02:58:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s8GoA-0005je-TL; Sat, 18 May 2024 05:56:54 -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 1s8Go9-0005jC-JO; Sat, 18 May 2024 05:56:53 -0400 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s8Go7-0001fw-T4; Sat, 18 May 2024 05:56:53 -0400 Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-5b277e17e15so1500750eaf.2; Sat, 18 May 2024 02:56:50 -0700 (PDT) Received: from wheely.local0.net (110-175-65-7.tpgi.com.au. [110.175.65.7]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2af57c3sm16540901b3a.178.2024.05.18.02.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 02:56:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716026209; x=1716631009; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=w3G0YjEj/ZtZfTFpVX30ielTug1SDL+ATHyj7RHn8kI=; b=KcnURe0Cy5xubhZbCWucdUPiIqjaEuZ1y/0XO9gWZQxQHug3vraxXtPb9XXMQxsE4q dVWILX67Oou4Sz+QpklXk5uS5eyRMhv02WecglH28NqEDl7myiAiYpzHDXWysAt4m+e8 2ttJMrHfvIoi6PL8GspvXcLew99xFDZ3k9vOTGSPopQe2ri/PSlGAzbW5x8u4hcQeyyZ arZGE1k0/J/Idber7Ck+P+SvMMLhoai9RHyY8fRtzUJwgpwjNk8K/0LzVDEaDIInWgGN /fBG4fMrjVbYqUHVyOrASYfMHoBTg/ktp3leuatijQOXnqxm60kg9d0Xoxe/V/XoSrU4 DI1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716026209; x=1716631009; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=w3G0YjEj/ZtZfTFpVX30ielTug1SDL+ATHyj7RHn8kI=; b=d1O8wYT2ujAqvO7CcPNad+7uSlW4FDK0URElOwojHlmTnRbPgGrsdBT/iy9iI029bt tzW8gciOEkXUc4rUEroaf702bbLteWhXBwXf621fe1fxg74dhfqzgpsrEF7YIfy4GJ8b ANm0rvid10aCOYyegin8FxcbbiMkXySfetnjOwZKJGViGRgFx7Dg85ZiHyQ6CjSSlFdg dS/ugRbdSL/yD7i2DZzMDLuHvw+c0oONjWWbXIRKzTWLmNfgJ4gxxAlsKR697Hv1fVSO WcaB+9NRe+ssQu243+NGfzV+4wUyE2lCuPezErp9F0iC3gB+nSEeTYdSD3ToPaVOU5WR hfFA== X-Forwarded-Encrypted: i=1; AJvYcCVkri+NujSri89K4OAybu0qUOM/lH7T4lztEDSg+PpixER2qrORKoVVcBvl2ZoAHGCeQrptbC0WqEzGTPWwHWRhaVd7zN8= X-Gm-Message-State: AOJu0Yz/ksAFUDFZYgvOKFTIEXmSxGhGWFa7aSbv6wPjP5+5/zQLFvCn dMThSX+ixQbUkFTOR+kElfYdGaaPGkU9g/84KEp9TCj7hLnVj9iqJVW/og== X-Google-Smtp-Source: AGHT+IGP7E9nkE5ttVABD9khmJCw0dQXV+lFeMYcn69duuSssZeelHJP/WAH6HabOjxMy2Cs0no+zQ== X-Received: by 2002:a05:6870:d0c6:b0:21e:7751:312c with SMTP id 586e51a60fabf-24172baaa00mr27375525fac.30.1716026208949; Sat, 18 May 2024 02:56:48 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , qemu-devel@nongnu.org Subject: [PATCH] ppc/spapr: Add ibm,pi-features Date: Sat, 18 May 2024 19:56:41 +1000 Message-ID: <20240518095641.408598-1-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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=2607:f8b0:4864:20::c32; envelope-from=npiggin@gmail.com; helo=mail-oo1-xc32.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1716026283471100001 Content-Type: text/plain; charset="utf-8" The ibm,pi-features property has a bit to say whether or not msgsndp should be used. Linux checks if it is being run under KVM and avoids msgsndp anyway, but it would be preferable to rely on this bit. Signed-off-by: Nicholas Piggin Reviewed-by: Harsh Prateek Bora --- hw/ppc/spapr.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 611a9e5184..6891d91e6e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -353,6 +353,31 @@ static void spapr_dt_pa_features(SpaprMachineState *sp= apr, _FDT((fdt_setprop(fdt, offset, "ibm,pa-features", pa_features, pa_size= ))); } =20 +static void spapr_dt_pi_features(SpaprMachineState *spapr, + PowerPCCPU *cpu, + void *fdt, int offset) +{ + uint8_t pi_features[] =3D { 1, 0, + 0x00 }; + + if (kvm_enabled() && ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, + 0, cpu->compat_pvr)) { + /* + * POWER9 and later CPUs with KVM run in LPAR-per-thread mode where + * all threads are essentially independent CPUs, and msgsndp does = not + * work (because it is physically-addressed) and therefore is + * emulated by KVM, so disable it here to ensure XIVE will be used. + * This is both KVM and CPU implementation-specific behaviour so a= KVM + * cap would be cleanest, but for now this works. If KVM ever perm= its + * native msgsndp execution by guests, a cap could be added at that + * time. + */ + pi_features[2] |=3D 0x08; /* 4: No msgsndp */ + } + + _FDT((fdt_setprop(fdt, offset, "ibm,pi-features", pi_features, sizeof(= pi_features)))); +} + static hwaddr spapr_node0_size(MachineState *machine) { if (machine->numa_state->num_nodes) { @@ -815,6 +840,8 @@ static void spapr_dt_cpu(CPUState *cs, void *fdt, int o= ffset, =20 spapr_dt_pa_features(spapr, cpu, fdt, offset); =20 + spapr_dt_pi_features(spapr, cpu, fdt, offset); + _FDT((fdt_setprop_cell(fdt, offset, "ibm,chip-id", cs->cpu_index / vcpus_per_socket))); =20 --=20 2.43.0