From nobody Sun Nov 24 23:51: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=1720028651; cv=none; d=zohomail.com; s=zohoarc; b=INggXJeSbakeLAEk31j/+CK9FOEF37oGERYqY79a/GprQoRrr1ck4pZBiq0wq0Rcq7iZyM2sXg96+AB+2aHZUcJgqbGsz+gqoUKDXnbPfhiAf5/28PEaQe1D7w0fZc80s0XyOGpv7nzJahfNnSby1VcQw+KePMIn+AKfnn0Lg/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720028651; h=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=De3e0JkeF4KrU8mLyYHH4oWICuiNeCJT2yMY2MkLLPg=; b=nhQ9FB5tBqs3+NkJ3GIVKvy3to4hwP7EQ+SjNz3xjUPU3X87lqvbADBdnE5s4iDszRGY2nrewpHcpA02rcEl0op12edpMlV43L92tN7yV2EEJKXkH+GC7+lU63x8fSWrwJFrD90GYw1x/44xocwkOM3MOVTpPE6GMgbQ5VZQ1r8= 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 1720028651279130.20657089453266; Wed, 3 Jul 2024 10:44:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sP40R-0003N5-02; Wed, 03 Jul 2024 13:42:59 -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 1sP40A-0003Iw-Hf for qemu-devel@nongnu.org; Wed, 03 Jul 2024 13:42:42 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sP400-0005LJ-LS for qemu-devel@nongnu.org; Wed, 03 Jul 2024 13:42:38 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2c983d8bdc7so496334a91.0 for ; Wed, 03 Jul 2024 10:42:31 -0700 (PDT) Received: from stoup.. (174-21-76-141.tukw.qwest.net. [174.21.76.141]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c91d3e7d7bsm11070030a91.47.2024.07.03.10.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 10:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720028551; x=1720633351; 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=De3e0JkeF4KrU8mLyYHH4oWICuiNeCJT2yMY2MkLLPg=; b=lI0wgVBbdL/OkbCQcICAWcRfrbJ7YWtCZHPrcQ/j6lPob9O5sunqiZpttDePhRiGRl aowGQ3837CC1oKgXl9hediY795a8xOgd8lWTQMHbMl5DL+TOejFDiUS2ZphUiRN/FO4b JVtYmp3RN5oKAHLg7XIXc36VRqZHuCj+3RuzN6XziqQ4zFR9uNvcWPBsrHTO7WATiDLC GfLmUtEjm66MfcAQxnXa1JBToxN1MJZAUcGhalp2cna3ORwsKr6XveoF84WXUAsZP6rL DV1duOPnRbLVBUZaRsdbV3MVTbwpUk76+AqLVFw9TV5gW87V4zPzYH2q34rkoJu2OesS DCAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720028551; x=1720633351; 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=De3e0JkeF4KrU8mLyYHH4oWICuiNeCJT2yMY2MkLLPg=; b=LVoo44MGadxGTd0kvCEUPc4rqtWP1osafdUR1MPjexqCLxpqe5bbu+hKH8GN3dI8Y0 SmYWGaRDL+Eks6Gtj+F9AgKTQBAA1cEFoaIku47cuDTGcJARJXTVonn2Kx9OPuYZN8T9 9J6tPsqiH4tfbZFg4WS/uvCEHOum6Kg5LwlJkyYlH1TcZiFOr1NuWKzqkulT6s6TIMfy Ww4ZJ+qabP+aOp/0LeJTwyT+Sy3rWE6LPFTAu1OSYM3yuJCAbnf1kgqYGB/6stNcsmM8 y/N4n7N0/Or9QGD8ltMyFZE2+M+qVSde0aqLQxfz1USwSKkx55nIhDftAT5SWVDzWze4 +djw== X-Gm-Message-State: AOJu0YwmFCTJ2nucvKVPPXdMPYwBezpcPkqRDoqSq8a/nIqQzLQnvfnd l9Nwcip8Yw/nwlcGifN9Wize+MX+BJihzEpI8F9Tae8KYlnozaLaH1B3Ymo8+C8kAPtg+HlPB1h B X-Google-Smtp-Source: AGHT+IFAzLW0FTyy1OFK0j6qIrp2qOU7JkCx9E3tvEwgoZbw5vq5GZnDQ4rlx6rq5X6FA4mZa8Fxyw== X-Received: by 2002:a17:90a:4e4f:b0:2c9:75a4:cc71 with SMTP id 98e67ed59e1d1-2c975a4cf19mr2066075a91.32.1720028550686; Wed, 03 Jul 2024 10:42:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Brad Smith Subject: [PULL 3/7] util/cpuinfo-aarch64: Add OpenBSD support Date: Wed, 3 Jul 2024 10:42:22 -0700 Message-Id: <20240703174226.2117169-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240703174226.2117169-1-richard.henderson@linaro.org> References: <20240703174226.2117169-1-richard.henderson@linaro.org> 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::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, T_SPF_TEMPERROR=0.01 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: 1720028653407100006 Content-Type: text/plain; charset="utf-8" From: Brad Smith Signed-off-by: Brad Smith Reviewed-by: Richard Henderson Message-Id: Signed-off-by: Richard Henderson --- util/cpuinfo-aarch64.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/util/cpuinfo-aarch64.c b/util/cpuinfo-aarch64.c index 4c8a005715..8ca775a14b 100644 --- a/util/cpuinfo-aarch64.c +++ b/util/cpuinfo-aarch64.c @@ -20,6 +20,12 @@ #ifdef CONFIG_DARWIN # include #endif +#ifdef __OpenBSD__ +# include +# include +# include +# include +#endif =20 unsigned cpuinfo; =20 @@ -72,6 +78,36 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) info |=3D sysctl_for_bool("hw.optional.arm.FEAT_PMULL") * CPUINFO_PMUL= L; info |=3D sysctl_for_bool("hw.optional.arm.FEAT_BTI") * CPUINFO_BTI; #endif +#ifdef __OpenBSD__ + int mib[2]; + uint64_t isar0; + uint64_t pfr1; + size_t len; + + mib[0] =3D CTL_MACHDEP; + mib[1] =3D CPU_ID_AA64ISAR0; + len =3D sizeof(isar0); + if (sysctl(mib, 2, &isar0, &len, NULL, 0) !=3D -1) { + if (ID_AA64ISAR0_ATOMIC(isar0) >=3D ID_AA64ISAR0_ATOMIC_IMPL) { + info |=3D CPUINFO_LSE; + } + if (ID_AA64ISAR0_AES(isar0) >=3D ID_AA64ISAR0_AES_BASE) { + info |=3D CPUINFO_AES; + } + if (ID_AA64ISAR0_AES(isar0) >=3D ID_AA64ISAR0_AES_PMULL) { + info |=3D CPUINFO_PMULL; + } + } + + mib[0] =3D CTL_MACHDEP; + mib[1] =3D CPU_ID_AA64PFR1; + len =3D sizeof(pfr1); + if (sysctl(mib, 2, &pfr1, &len, NULL, 0) !=3D -1) { + if (ID_AA64PFR1_BT(pfr1) >=3D ID_AA64PFR1_BT_IMPL) { + info |=3D CPUINFO_BTI; + } + } +#endif =20 cpuinfo =3D info; return info; --=20 2.34.1