From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6596DC43460 for ; Wed, 12 May 2021 18:03:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C6F461480 for ; Wed, 12 May 2021 18:03:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240909AbhELR7L (ORCPT ); Wed, 12 May 2021 13:59:11 -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-Google-Smtp-Source: ABdhPJxjjVYaIi+t31QOtss36tD43pS9VcAHQRx7BwGpSbz1EiFLY3aY+wnVwNvTaLIhrmMl549xTg== 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.