Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4694574pxj; Wed, 12 May 2021 11:04:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPRlF8fPs/WEl3I/AefWBI4ScBVJy8Nsdl/oLqercZUOdp3gzsdui0fqZIryPWaFKw7rbd X-Received: by 2002:a17:907:2645:: with SMTP id ar5mr1068603ejc.315.1620842642604; Wed, 12 May 2021 11:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620842642; cv=none; d=google.com; s=arc-20160816; b=WCZQ1naK7Oxi5IhjXVDKszOFLGo4az2rq+hd7rhBvrZrh4BR2W9oPDuglwkwB6kwei jGn8VsQ8pS8YrbiI4St+jCTQYAjvs+aUx6unUo7Uk6D16UO8N8f6fscwbyeDrBr0+4lN Z5n8ZsiKVpp23wVJdQXt3EUi32OKnJxc0ev4mV08mfdIK2OTjzl3vxPYhJ/VljJuz496 M9miM3SeopHXzo6/rnXmsxoZLyA/mUu5yMj1HY6bsxoafuuiJUZELBBKAh5Rx/B6Wb+u QAkDCefLMMaUjQTucgRvqqWwQ1rH8ne+jGkClt7AIwVVfD2GZQO1kcBAEYhZJII2/PEm iTzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ICPdyZXgRBAbj7CZwz12a51xwM2NvcuqGhPg+kKEs68=; b=yo0EQS9CWExB2hnYFNb244EPxlC4j8dGmZ3Gg4LZANRrwZfOvoZgohlxgkJjFifYAD gy1yG1Vm+prQlUW7A2ivbS4zPBn0BTpSxptUMcRZDhGtbLec+GCgtoWRGilFAk6/3YqG 0qNakOwuKTabWtfu01Gb1xoJWM+mGvZsUQhguXLTabYdlieR6NatSZTvzFY+P3rrjpsH UpShcaAcP0/uhXlA6rGTdlHVDWivblQk2Iz2QkXSj0pPEfWQOYYPmSS34BOLj9rO205I J+V6kBOgLiJhWKSUU/60/VclZbSYsY5dqj03AhfGqx9gNjiWBwZMPlpK5wKW2V+LJ7Y5 JEDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WRfFMP8F; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si280125ede.263.2021.05.12.11.03.30; Wed, 12 May 2021 11:04:02 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=WRfFMP8F; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241399AbhELR7E (ORCPT + 99 others); Wed, 12 May 2021 13:59:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240882AbhELQZt (ORCPT ); Wed, 12 May 2021 12:25:49 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98D7DC061763 for ; Wed, 12 May 2021 08:53:58 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id l70so3791719pga.1 for ; Wed, 12 May 2021 08:53:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ICPdyZXgRBAbj7CZwz12a51xwM2NvcuqGhPg+kKEs68=; b=WRfFMP8FAsXBX5doVKGofdL4hb9UH5YmwTfiLq95ByKa23qd3+NlfzCD4APred1OVl e5Osg5WZjJEzzVSCNIb9r3z5Ym6/oFncGsbIdZJ3QCrERONT0jd6R8+2Bov4gauJkCXW J0aW3nKrF5JSqEgVYmttYuCDAVj931OYBP0j2hTU1aL1tGcyLWS8gLShmWRStwS1na5o 3okqXLK+JpT799BWDzOECK3EQs93AGs75PHemQSdFdbeKsTHXcP+gZJ3TemNEqun8iZz 3Iw4VMgY+5U0JtMH09eCDrP8REfrbxi6PTgcRrpa/zMt8ZHH9DhS7h5v8EZS2LTToCRB Mb5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ICPdyZXgRBAbj7CZwz12a51xwM2NvcuqGhPg+kKEs68=; b=O0/u319mEzrJ18N1j984yqZai9dIqw//10RUcpc67b2Pk5Y4vFXGFdZ8ctrzrl1dPK lzXpMN0Bv1RSz2s4p3CEEBUpVZTcJoh6EWgIUogzKAip947FDWvfI6RFlD8O8QoTks5S 6JFhZoK86xWydiMdwFnsr1eDoAhkP7CDnm6gR/BYQYkA0KOy+WlH58F//qTaIGOYneSb I4dKR1vVl7AfNHZmqkmjqtciYk12rpXKk5CZqAAZhDwy+zcdRa7HR8pzDME9fUo0OLXa Tyt2W2olEnJPE3UqqrgZQzkaN0gqAVHl3cm2Q8rRhBSv8VD8uyynkE7LilYkczR1rES0 gM0A== X-Gm-Message-State: AOAM5317ldY2ZekQm9lGC7EF6QAW2BL7fOdX08N7J8NW/Re9yr8WDsEa nK+SFXwBqZTgBJBU5uel+53tSw== X-Received: by 2002:aa7:8194:0:b029:2aa:db3a:4c1d with SMTP id g20-20020aa781940000b02902aadb3a4c1dmr27280097pfi.58.1620834838027; Wed, 12 May 2021 08:53:58 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id v17sm213521pfi.188.2021.05.12.08.53.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 08:53:57 -0700 (PDT) Date: Wed, 12 May 2021 15:53:53 +0000 From: Sean Christopherson To: Dave Hansen Cc: "Kirill A. Shutemov" , "Kuppuswamy, Sathyanarayanan" , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck , Andi Kleen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , linux-kernel@vger.kernel.org Subject: Re: [RFC v2 26/32] x86/mm: Move force_dma_unencrypted() to common code Message-ID: References: <7c5adf75d69ea327b22b404b7c37b29712d73640.1619458733.git.sathyanarayanan.kuppuswamy@linux.intel.com> <5536639a-918d-de8d-ff32-934a13902a03@intel.com> <20210512130821.7r2rtzcyjltecun7@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 12, 2021, Dave Hansen wrote: > On 5/12/21 6:08 AM, Kirill A. Shutemov wrote: > >> That's not an excuse to have a bunch of AMD (or Intel) feature-specific > >> code in a file named "common". I'd make an attempt to keep them > >> separate and then call into the two separate functions *from* the common > >> function. > > But why? What good does the additional level of inderection brings? > > > > It's like saying arch/x86/kernel/cpu/common.c shouldn't have anything AMD > > or Intel specific. If a function can cover both vendors I don't see a > > point for additinal complexity. > > Because the code is already separate. You're actually going to some > trouble to move the SEV-specific code and then combine it with the > TDX-specific code. > > Anyway, please just give it a shot. Should take all of ten minutes. If > it doesn't work out in practice, fine. You'll have a good paragraph for > the changelog. Or maybe wait to see how Boris' propose protected_guest_has() pans out? E.g. if we can do "protected_guest_has(MEMORY_ENCRYPTION)" or whatever, then the truly common bits could be placed into common.c without any vendor-specific logic.