Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1683281pxj; Wed, 19 May 2021 11:23:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEp5mxJNVxOJw1JMFATGNExpm9Oi4wiosJVzXKOIZ0zxi8tJguvr4vlPCnip6Neg359Ct8 X-Received: by 2002:a6b:6b11:: with SMTP id g17mr839081ioc.72.1621448586608; Wed, 19 May 2021 11:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621448586; cv=none; d=google.com; s=arc-20160816; b=V6URjXB7RH9Q4sOvYWDiIHMqT45PB7ZT6uUNHzsG9Gg0je2iPYh/VD7Q/IekAKBNo5 LZT0qCdsBToZ1a/BFi8f/URDHJF0b+gt/oT6YqlqfV6Qcb6RNmlBcTDbLUGkWr4IpfB6 95X8dcPXBA8iNNyMXhaaoBMpdwzbRWG7GAfvm/Ro7v6VCMZ96d6X5HoSYyWFjBTk8u2Y sJTzMuZMGEw51F6DgFScI1Y2IiTFqqcZRFDjjr86280ntDge2qNDhqTuxyDliZvgg6Rm Vsvt6Eu48IHH6SotlhfYgJzgrecBuAhGhLjLaS8Zpr1VQOYTQS89PtnGmnQky3vlGLAk Lvbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=kQhR7D99JymoiflURCD9gfNJOSyhqesip++Vi+DyGdw=; b=dMlRsvQ4Mur2c58Zl4WTHU7gibAvDNlfjiEp7NdQpcFCE7/SBPdXArwn04yv/hp1H5 t8G3EJRr3teu5kQ8LEvd1entJxpuCfR5UgBVmBafgfRld63dwnWAxjYNbDoXUKdF0QGR nnLGkM/uFUd8lDoJsTvD9XeUsqcfXTQxcjh2KiE6xIkIL1PKbIdDsOw0xme6/zsAKOkA 7TfZJJfKA1uogd26IoCQBVcwMa+hndt/MNg+2Vuqh4cGqtFQ7+QoJvaSOauFAP+4ww9Q MKXG1Se97UYDCD/nLu5Gt7aMW4oZ+YNolz51jv1j3hRPHFTv8J4paOb462LN/k0gTWpX Capw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si29843jas.31.2021.05.19.11.22.54; Wed, 19 May 2021 11:23:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350430AbhERQLy (ORCPT + 99 others); Tue, 18 May 2021 12:11:54 -0400 Received: from mga02.intel.com ([134.134.136.20]:60211 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344604AbhERQLx (ORCPT ); Tue, 18 May 2021 12:11:53 -0400 IronPort-SDR: X0R0zvuAgcLq2gyOMf7j2M9x686tlTFxrv9qrsrgiiQ8j3Csx6K3j+F7uO985hSRsiwalgxB3d fE+2MP4AkRsA== X-IronPort-AV: E=McAfee;i="6200,9189,9988"; a="187876019" X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="187876019" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 09:10:06 -0700 IronPort-SDR: kmGiyr+Bq3vHPT6wHBn+AK/L1D6QMQn/asQRKwONY3Li/Sl1/4ReMc4omdVFtJ+40/KWOWpPdy jTUpmnSGaJfA== X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="439506337" Received: from msaber-mobl.amr.corp.intel.com (HELO [10.209.65.183]) ([10.209.65.183]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 09:10:05 -0700 Subject: Re: [RFC v2-fix 1/1] x86/tdx: Handle in-kernel MMIO To: Dave Hansen , Kuppuswamy Sathyanarayanan , Peter Zijlstra , Andy Lutomirski Cc: Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Dan Williams , Raj Ashok , Sean Christopherson , linux-kernel@vger.kernel.org References: <3e9a26c3-8eee-88f5-f8e2-8a2dd2c028ea@intel.com> <20210518004807.258503-1-sathyanarayanan.kuppuswamy@linux.intel.com> <36cd2665-6d8b-9c0b-eec1-25152dcca2a3@intel.com> <43e583a3-ee2b-52d8-5275-e26a6609c126@linux.intel.com> <94dc5a5a-8c51-8624-5810-e6278783789c@intel.com> From: Andi Kleen Message-ID: Date: Tue, 18 May 2021 09:10:04 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <94dc5a5a-8c51-8624-5810-e6278783789c@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>>> For now we only handle a subset of instructions that the kernel >>>> uses for MMIO operations. User-space access triggers SIGBUS. >>> How do you know which instructions the kernel uses? >> They're all in MMIO macros. > I've heard exactly the opposite from the TDX team in the past. What I > remember was a claim that one can not just leverage the MMIO macros as a > single point to avoid MMIO. I remember being told that not all code in > the kernel that does MMIO uses these macros. APIC MMIO's were called > out as a place that does not use the MMIO macros. Yes x86 APIC has its own macros, but we don't use the MMIO based APIC, only X2APIC in TDX. I'm not aware of any other places that would do MMIO without using the standard io.h macros, although it might happen in theory on x86 (but would likely break on some other architectures) -Andi