From patchwork Thu Nov 4 12:54:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1550904 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=ptfHVc+k; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlNt64sdmz9s0r for ; Thu, 4 Nov 2021 23:55:58 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1micHS-0004yG-Kk; Thu, 04 Nov 2021 12:55:46 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1micH4-0004Sy-IR for kernel-team@lists.ubuntu.com; Thu, 04 Nov 2021 12:55:22 +0000 Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 010E63F1F6 for ; Thu, 4 Nov 2021 12:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1636030522; bh=F17SCjXda2bfvYDvPvBoKkCYGxiqWV4NcfQdG8KBo1Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ptfHVc+kOGSe4CAg9cPubBIePp7Ja62Y2izMI7MxQC3ha7cn2HXA25LUc6+c+Rybi yYiuq+gPODVpiU0aQxwncaVjn6LLLd6KpfLgFrzdUtiB23IK1ISNErgvLhqWqxXquL tR7tOm5ZfDBGo3OpUApRWPjX8fC167L/00z/429kXxSrNij5o0tGMY4+Z6CQfV1d5P NbFQsNuiP0nthoqYqnBq/39TRaZupjUjHl1cnMCo7L/mhPiugi/gDGXlGS/uNrjGA5 7x5YBMdRlfhIziHfwryHkQwOTmCcnN4dtD07MmVTauZgTBYjlTz0vvYCo+quaCQRVg UX7hRnpqZzEBg== Received: by mail-pl1-f198.google.com with SMTP id n9-20020a170902968900b0013f23b51142so3174030plp.8 for ; Thu, 04 Nov 2021 05:55:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F17SCjXda2bfvYDvPvBoKkCYGxiqWV4NcfQdG8KBo1Y=; b=0cmru+oMTCI0kUlvg+V6tQ0BdXVkWVs0/20yW7jroegDcclJ0XyjpOU0+BiIubJdn8 iX5LsGdHrbEAguTV/+mr9Vb57qJ41hWr67Xqf1xHzrqgNmQSEk93ySIAD9w28zJ3LPsr EPgcFRYvgODgU8DJj32oVYpFz0f5cQHMRaigNJAdzYQ88yNQkzvSq8/FkxjZVNM4BawT HyjzO2IE9mXhdx4RphWnnB3h/0QxPODteKzq2VQGf4T7DLPjgbe2vJz34jnCusgw4qij tSDV89ns7KlKjaQtP9iP8r/NTGkTtiOD5fOLy8HbpzXt2huYxt4w43ALC1GQmuZgEvku 1UmA== X-Gm-Message-State: AOAM532I9/gc/uRLy6fPC96uvUuMyEyuAcalWTVh8RwsUyMpKK1W5SYP P5xDmEEO0+4yCAprcVcMqwEG64++W2FkonhqRkYyaKQjNPDZBh47RBUYGk0Rz3ugsHJtR1Xy0FP D2sMM8n5QdI3lBzZV8wYMgT91EznZ441h7jvyRG36SA== X-Received: by 2002:a05:6a00:1995:b0:47c:1e13:b679 with SMTP id d21-20020a056a00199500b0047c1e13b679mr51509474pfl.19.1636030520161; Thu, 04 Nov 2021 05:55:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYGIn3pH8idaTC9oZIblsxSnGVRokrnHOp/T6Cq0To0fdHwSW7Cx8ae9zGTNUe2C+8ncjtuw== X-Received: by 2002:a05:6a00:1995:b0:47c:1e13:b679 with SMTP id d21-20020a056a00199500b0047c1e13b679mr51509446pfl.19.1636030519923; Thu, 04 Nov 2021 05:55:19 -0700 (PDT) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id y4sm5283859pfi.178.2021.11.04.05.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 05:55:19 -0700 (PDT) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 11/41] clocksource/hyperv: use MSR-based access if running as root Date: Thu, 4 Nov 2021 06:54:19 -0600 Message-Id: <20211104125449.16540-12-tim.gardner@canonical.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211104125449.16540-1-tim.gardner@canonical.com> References: <20211104125449.16540-1-tim.gardner@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Wei Liu BugLink: https://bugs.launchpad.net/bugs/1949770 When Linux runs as the root partition, the setup required for TSC page is different. Luckily Linux also has access to the MSR based clocksource. We can just disable the TSC page clocksource if Linux is the root partition. Signed-off-by: Wei Liu Acked-by: Daniel Lezcano Reviewed-by: Pavel Tatashin Reviewed-by: Michael Kelley Link: https://lore.kernel.org/r/20210203150435.27941-5-wei.liu@kernel.org (cherry picked from commit 7d4163c8315729140ad99d6e1ab10dfc7a685640) Signed-off-by: Marcelo Henrique Cerri --- drivers/clocksource/hyperv_timer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index 4c9e6a87c438..10eb5c645141 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -455,6 +455,9 @@ static bool __init hv_init_tsc_clocksource(void) if (!(ms_hyperv.features & HV_MSR_REFERENCE_TSC_AVAILABLE)) return false; + if (hv_root_partition) + return false; + hv_read_reference_counter = read_hv_clock_tsc; phys_addr = virt_to_phys(hv_get_tsc_page());