Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp523881rdb; Thu, 22 Feb 2024 10:43:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW/jEHmT5sDdAuPwRtQffB46Z1T+K1rTenyITYwYayUltemE1UhFhggLtU2reSH38otbuKTvTMsRh3GFzRAmsJSZrQfBsX3riBxG/+XFQ== X-Google-Smtp-Source: AGHT+IG7K098hTxzLnf4zd1zyPIQ++AXK3FZ4b0Wze+mWojinyaDSl5va5A5/twAcF/0ZtW8ujRF X-Received: by 2002:a05:620a:46a3:b0:787:7cc6:4424 with SMTP id bq35-20020a05620a46a300b007877cc64424mr9311521qkb.8.1708627401632; Thu, 22 Feb 2024 10:43:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708627401; cv=pass; d=google.com; s=arc-20160816; b=VKZb0xfkqhsmCBCh9fUtruneCPOA+QtVNCLXbvi/ho5ERg1YmMiB3e2KqDtKUy9Gig iJhZzQ7PHkO6AXjVxDEHr+vi+bGNdUMCqrmPXez9OYWJJfXgQs8ohUEVGMccUy0E8qDp kN8CrdWhfrg7aqe2Yh/RkB9kNq8ldEZZCqVf/pEFfciHXtau6j2NkfL0s72EmGfplo1K 9hzRSWqN7+6RmOpadFYMDZWGNuePRGB6L29NaALqq1yl/fXtcTIpmZPXJh9mFwF/GKqY CUczIuHuJ93LwJbtX4blbrKLtFO4+5pVPb+mFBp0EcS3iXtetJyDXYQ1hewV6U+9y56R yRbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id :in-reply-to:references:date:from:cc:to:subject:dkim-signature; bh=1/fX26JDlAaqqAJniW3LfEEgT/3VqQtr7lSaAI9WgVo=; fh=HUgOPOMLUPcroonsK10/uEWpbBCP57e0QFUoVmMwghQ=; b=k+fMZR1w4Zjb6/tmEDd8iduqDdDthSAEsPbo/OxKNqUxrC1xwte2I84aCG/mMXAsOb nhHxPn8OphdbkKkwaN96AnYAsHJczKdnv3fpgSLZZLUw21KZrjSUQd0UF06Z5jdl0AVN cmtZzIRS6ijptuvBg5Vq2y4tUK45JTdrZu/THvsrIhubwIejXGoXU8XimszwAPbX3Acd zdfgf+NPhGmIfRRJA8JvOZ7A557rP7hk2eJ3VIlTBs4iYHJYVHWWoA06/zR4iKi4c6D6 x3Fwc0zAGtT1i8FdTF+gRtKD75NlAYqSy4PV/I758sDTrmPk5dZH59sp40GFbfULv4uA XNNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SJgXYgLr; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-77157-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77157-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pj6-20020a05620a1d8600b00785ca459548si13127561qkn.113.2024.02.22.10.43.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 10:43:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77157-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SJgXYgLr; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-77157-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77157-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4E1641C24BA4 for ; Thu, 22 Feb 2024 18:43:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B32C6AFA2; Thu, 22 Feb 2024 18:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SJgXYgLr" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B126548FF for ; Thu, 22 Feb 2024 18:39:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708627172; cv=none; b=P2Fu7thFCNcO0Bs1kjTNS9v/BgfUZD+EWc+to3cQeKmA6jVD5kuukbw2a0tZNVdqWSbgq9WlNo4o94/dlKJS0SVz+6/PIcHz+30Kagy0OyVRoBp3wyWt6S9NTp6RE83ZKji5bRgdO3mk/YKmwG761r95NqRUKhgr5QcXmPIJmUI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708627172; c=relaxed/simple; bh=reS7y9hoRcSiyLDxW0i1cvzSnB6X77odpIXVmZj0hO4=; h=Subject:To:Cc:From:Date:References:In-Reply-To:Message-Id; b=qkAYQ4ivATkMts+FGPm2koNvE72OMD/hOG6w8Szyb037WZEF/lWPIWa66lBf81pRJntNoLF0has93vETaJP9l1xaUbeIiE9mD8lfwsCQjpgA+sv7asMpXyrsj1qGx9TVLUfgJPlDsEpxmxcwzl9SEgoZYcy2nWwvPKDxzUbLbAY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SJgXYgLr; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708627172; x=1740163172; h=subject:to:cc:from:date:references:in-reply-to: message-id; bh=reS7y9hoRcSiyLDxW0i1cvzSnB6X77odpIXVmZj0hO4=; b=SJgXYgLr8wewQQzMBKjs0KtCdD2lgB3k/CIaNQ0Uk4+sHaRVK2n6zi1x 2cIeOsCmCKs3uQSBfprkfFMpASEGDbD/VrLogRUbZltUzGnyh5X8qA1DO Z6UtJ+3xiIxSIfeP8qtdcWoWb1kMJZ3xo0ZbM16ZeY2bfg6AEMt2Tzn7n uOx8OxnWYDRCxy6FP3gtnVIiWf4gpr/RDWq7jqtC6E8PfLrDZngdEpNkx cyu0ek6jCFvKU+5Up2Sfc7WzV4KzU5c/4Awcxv9elkIv3e7vZSMw5/1Oa N6nv/UJZ50z8zPw1k75rV6/ge3Xq/DhEoxqGZTGxPh9fe78uuvyNSstsf Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="3031700" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="3031700" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 10:39:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="5975391" Received: from davehans-spike.ostc.intel.com (HELO localhost.localdomain) ([10.165.164.11]) by orviesa008.jf.intel.com with ESMTP; 22 Feb 2024 10:39:31 -0800 Subject: [RFC][PATCH 03/34] x86/pci: Assume that clflush size is always provided To: linux-kernel@vger.kernel.org Cc: kirill.shutemov@linux.intel.com,pbonzini@redhat.com,tglx@linutronix.de,x86@kernel.org,bp@alien8.de,Dave Hansen From: Dave Hansen Date: Thu, 22 Feb 2024 10:39:30 -0800 References: <20240222183926.517AFCD2@davehans-spike.ostc.intel.com> In-Reply-To: <20240222183926.517AFCD2@davehans-spike.ostc.intel.com> Message-Id: <20240222183930.18D74E8B@davehans-spike.ostc.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Dave Hansen The early boot code always sets _some_ clflush size. Use that fact to avoid handling the case where it is not set. There may have been a time when the Xen PV call in here way too early. But it calls get_cpu_address_sizes() before calling here now. It should also be safe. Note: This series will eventually return sane defaults even very early in boot. I believe this is safe now, but it becomes *really* safe later on. Signed-off-by: Dave Hansen --- b/arch/x86/pci/common.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff -puN arch/x86/pci/common.c~x86-pci-clflush-size arch/x86/pci/common.c --- a/arch/x86/pci/common.c~x86-pci-clflush-size 2024-02-22 10:08:49.356488521 -0800 +++ b/arch/x86/pci/common.c 2024-02-22 10:08:49.356488521 -0800 @@ -480,22 +480,9 @@ void pcibios_scan_root(int busnum) void __init pcibios_set_cache_line_size(void) { - struct cpuinfo_x86 *c = &boot_cpu_data; - - /* - * Set PCI cacheline size to that of the CPU if the CPU has reported it. - * (For older CPUs that don't support cpuid, we se it to 32 bytes - * It's also good for 386/486s (which actually have 16) - * as quite a few PCI devices do not support smaller values. - */ - if (c->x86_clflush_size > 0) { - pci_dfl_cache_line_size = c->x86_clflush_size >> 2; - printk(KERN_DEBUG "PCI: pci_cache_line_size set to %d bytes\n", - pci_dfl_cache_line_size << 2); - } else { - pci_dfl_cache_line_size = 32 >> 2; - printk(KERN_DEBUG "PCI: Unknown cacheline size. Setting to 32 bytes\n"); - } + pci_dfl_cache_line_size = boot_cpu_data.x86_clflush_size >> 2; + printk(KERN_DEBUG "PCI: pci_cache_line_size set to %d bytes\n", + pci_dfl_cache_line_size << 2); } int __init pcibios_init(void) _