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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 28D25C433B4 for ; Wed, 12 May 2021 13:08:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E586261289 for ; Wed, 12 May 2021 13:08:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231764AbhELNJb (ORCPT ); Wed, 12 May 2021 09:09:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbhELNJa (ORCPT ); Wed, 12 May 2021 09:09:30 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC7B9C061574 for ; Wed, 12 May 2021 06:08:21 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id z13so33663068lft.1 for ; Wed, 12 May 2021 06:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=Iw5ZdnIrZYIGz1+2Q8w3rA9D0sH6uyzMgpL7tI8AL3k=; b=ksfGqKym2FPVhYBacELqLrOBKjbC4fUgw6JdQebX2sVsgMnVWP3I9FtMVtLUx5QnY3 cVq1a++ulPmSS3okWx/HoDiZPeLOzjKmZK/9LArL0khfgtxcBNbNBDhnB06lsTLbaNvi Tp3MkXFpsH7mP8Q7uDUqAmqCeAGwyajMU3+b1Z9P+ojzB/19H45dTqVMf3zElJEV+Szr Aq0YM2IpCpFufsgO2SF5gVKlcCmoDv+HlAe0p10jhHNpCwr2kvSc3cAlC6dp3M2AXUIW 85Xial4PyGQgnCWEdqigbqX5+goW7UI49tSHv0IUu6J9Dppnu5GJaEU6v95QrqUUO60A yu2Q== 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:content-transfer-encoding :in-reply-to; bh=Iw5ZdnIrZYIGz1+2Q8w3rA9D0sH6uyzMgpL7tI8AL3k=; b=XIoTv1guyZrmeN5yWFC+H3VZghWBvzCXEK5HwQApZ/4AD+s4l5PmSgZ2x9FEDzHpQb 2phMfQbvncqczl7XoDeQnCX5Mwq+r9wO1bHdpjxZhOrWL+23uP/oNSRWB1KV+PK0Pe03 jgbWzZC2HNQ9QUX0eHW5lZQQp1p2ksCDBxdOo/WjWI9c9/2g5RH1l7kcJfgYH1TYLzs4 cy28CHzYZdgyHYO8L685zmwXboaMYA8+ZlitgbO33kVozLnp+CdjcMeCdU9t/9U+jo1b Mwme+3mwYCzdjJjkYpJcCrTyYp2anw97SlP0UeZw+5DU2Zt3dLQ+QtECzm7zS8kriIOP tZcA== X-Gm-Message-State: AOAM530/5C1tC98AOG058mQyUkfK+SYGCvJj71xFndpeancLLu8P4HVu a7TG3s9nDtFGP2pfgRxDo3ZxQw== X-Google-Smtp-Source: ABdhPJxABrzJreB8kapKFo1bvTNEo0K1BUkIGFbgYZMqsZY/6S7j0iLjsta1W2WidDoy/IymaaCqzg== X-Received: by 2002:ac2:5e25:: with SMTP id o5mr13873313lfg.638.1620824900510; Wed, 12 May 2021 06:08:20 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id c14sm810992lfb.129.2021.05.12.06.08.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 06:08:19 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 1B24910265F; Wed, 12 May 2021 16:08:21 +0300 (+03) Date: Wed, 12 May 2021 16:08:21 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: "Kuppuswamy, Sathyanarayanan" , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck , Andi Kleen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , Sean Christopherson , linux-kernel@vger.kernel.org Subject: Re: [RFC v2 26/32] x86/mm: Move force_dma_unencrypted() to common code Message-ID: <20210512130821.7r2rtzcyjltecun7@box.shutemov.name> References: <7c5adf75d69ea327b22b404b7c37b29712d73640.1619458733.git.sathyanarayanan.kuppuswamy@linux.intel.com> <5536639a-918d-de8d-ff32-934a13902a03@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 10, 2021 at 03:23:29PM -0700, Dave Hansen wrote: > On 5/10/21 3:19 PM, Kuppuswamy, Sathyanarayanan wrote: > > On 5/7/21 2:54 PM, Dave Hansen wrote: > >> This doesn't seem much like common code to me.  It seems like 100% SEV > >> code.  Is this really where we want to move it? > > > > Both SEV and TDX code has requirement to enable > > CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED and define force_dma_unencrypted() > > function. > > > > force_dma_unencrypted() is modified by patch titled "x86/tdx: Make DMA > > pages shared" to add TDX guest specific support. > > > > Since both SEV and TDX code uses it, its moved to common file. > > 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. -- Kirill A. Shutemov