Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp821687pxp; Wed, 9 Mar 2022 13:26:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxISDvyXmv9H74fLNnDIz/pzYg0mjLYprsqIfDhYe75mPpuakmvlTFhAOwAEe2URUWloFFx X-Received: by 2002:a17:90b:4f4b:b0:1bf:bd24:263f with SMTP id pj11-20020a17090b4f4b00b001bfbd24263fmr1543740pjb.228.1646861219106; Wed, 09 Mar 2022 13:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646861219; cv=none; d=google.com; s=arc-20160816; b=0/x97fyJfr5MeleiU9Rzsouk8IidXBR27O1Ssgu0k2gLypSccX4SpUzBOp9Ea79wCI dyAb5Fassz0sFwP5829T8FU5cXCtkFqXRv9Z5u0dwkKei2Gadg1Iuxm0BlwQpHeJjzyN 6+wVwKrq9YKBsIsiv8DOBNzaaAxdIHgglZMe7gm899dcIzHUpIAZxDwlzE5af7l0Od67 pSZ1A8psjtK8HTtiyWIaacsAvBaRVUjVoqPinD9M9HoU3wiAdpWRVnzR04651KFTWn1J Z0rjJ3aums1+x4Wdff3fbMW/Pcau4YKzsknNsO3KfpFp13hcQ+BxwFv3+nieZtjPM20Y Q4aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ndx32WBmfBxuvJH6NgXVPP6Qai1KeFznS/MWmU68F2k=; b=xlcca7UrvowW7TGbqog6c8vXsuNoIyvMIMWKlpG7ovLzWNOKWncu+097xTb/m8hHWj +gNu7nypdud5ECV6vG2i4Uh29uNIi/uJBF75WiyKg7G1xMS/UBEEBxtB/u0hTa8aK1yf fOp+4XNxi0CixWYwudz/4XT3hiFvSzYysStzy/s7SV80g+shO6/GMZ5dWMbWtwb2zPDb IhAcHa7OUMOLw5V4EtUs/Xa0iB5yjFwGMMczS4VVmotH4PanNMz5dpIIMdoSdezIDHaY QO5F295sgLTGaPQlMBnL4zGtnr6XX5HY3/lEOqSq7DTa0ClpgFIZ0MVHiQNmUubhdqit Towg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=YQjVRwGs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020a654645000000b00378c9e5630bsi3013348pgr.555.2022.03.09.13.26.42; Wed, 09 Mar 2022 13:26:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=YQjVRwGs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236618AbiCIRLT (ORCPT + 99 others); Wed, 9 Mar 2022 12:11:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236634AbiCIRLA (ORCPT ); Wed, 9 Mar 2022 12:11:00 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B212DFA for ; Wed, 9 Mar 2022 09:04:14 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id k8-20020a05600c1c8800b003899c7ac55dso2996957wms.1 for ; Wed, 09 Mar 2022 09:04:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ndx32WBmfBxuvJH6NgXVPP6Qai1KeFznS/MWmU68F2k=; b=YQjVRwGsmDyttSMWRArNfLF0dqeQKY8E/07xyYcuzGr0kpyfDmH8G4dbdGdwdlBwnP zX1OtOneZOfWA5I7yR+egmuSJ2jHhH7Ut7NmOVk1XPYZi0TADjvFf5B5DFIvdUkNY62P +cvUl3a7OfQRD0oBDWHHEUNpZ7y2RxB1g2F8aRdKdvN5tt4jdIZjz2wzUoM1Xdj+uEwz 4YWWV1fNTpxtUqI9nbSpNzW55JCP6aUHS8hIbhGRLCdSUpYypgBjKrYzBB4AnrJV5Wj8 Cxpn/g7Z6EZckp3ywXFFKd8kS5wEwjqPOsYOOYEeBNo2wik/g+SdAai+Er3kQuhh/VAp xKRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ndx32WBmfBxuvJH6NgXVPP6Qai1KeFznS/MWmU68F2k=; b=6Bk+ccegWlQCINtBFIEKQzIgyhSauZlsTN30QNnu9d+7LGuzI36dI0/USLWH21wJKN bRaJQf4h77Jl20NRW8OY+Xc04gq69RH+XZw5GuCTzONqwcG0mJf7sGLOvM35joi7HvFB iTlBUYFe7JeoS1l/JoEPhe97knQvilrSula6uKHRIuAopxrLEpAyUulHyJhCP+f9t4ur 7nQQDH2CeFEUk4mKZ4HjosNpGzoQTDXVLuvX1tV5v66cOaoEd9yGFEOgK0UfT9xGjBKf 1ziiiFWco7wkL98TNsd1u1KUwj7fg1zyEXi0Wp5AXiLjGUl0aKe0WRm+VYY0etrL/tHD VI5Q== X-Gm-Message-State: AOAM532nQFu5EoXUgas/KMnlGcGhFciEqyrKgyojunQk8rfO5VN1fByl dNvaiD6PLkN1gdRtXlUHTjwTHUKPpZUiMhokygWStA== X-Received: by 2002:a7b:c057:0:b0:37b:ebad:c9c8 with SMTP id u23-20020a7bc057000000b0037bebadc9c8mr8419395wmc.61.1646845453376; Wed, 09 Mar 2022 09:04:13 -0800 (PST) MIME-Version: 1.0 References: <20220307184935.1704614-1-kaleshsingh@google.com> <20220307184935.1704614-2-kaleshsingh@google.com> In-Reply-To: From: Kalesh Singh Date: Wed, 9 Mar 2022 09:04:01 -0800 Message-ID: Subject: Re: [PATCH v5 1/8] KVM: arm64: Introduce hyp_alloc_private_va_range() To: Quentin Perret Cc: Stephen Boyd , Will Deacon , Marc Zyngier , Fuad Tabba , Suren Baghdasaryan , "Cc: Android Kernel" , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Mark Rutland , Mark Brown , Masami Hiramatsu , Peter Collingbourne , "Madhavan T. Venkataraman" , Andrew Scull , "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" , kvmarm , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 9, 2022 at 8:50 AM Quentin Perret wrote: > > On Tuesday 08 Mar 2022 at 15:09:18 (-0800), Kalesh Singh wrote: > > On Tue, Mar 8, 2022 at 12:21 PM Stephen Boyd wrote: > > > It looks odd to use an error pointer casted to unsigned long to return > > > from an address allocation function. Why not pass a pointer for base > > > like the function was written before and return an int from this > > > function with 0 for success and negative error value?Otherwise some > > > sort of define should made like DMA_MAPPING_ERROR and that can be used > > > to indicate to the caller that the allocation failed, or a simple zero > > > may work? > > > > I wanted to keep consistent between the pkvm and traditional nvhe > > code. I will refactor both *alloc_private_va_range() functions to take > > a pointer and return an int error if that's preferred. There would > > still be a case of this kind of cast in > > __pkvm_create_private_mapping() which does return an unsigned long > > address or ERR_PTR(...). It looks like it was made to return the > > address to facilitate use as a hypercall (@Quentin CMIW). > > Yep, passing everything by value was much easier to cross the EL1/EL2 > boundary as that avoids having the hypervisor map kernel memory and all > that fun. But Stephen's point is fair, so no objection from to keep this > little dance confined to the hypercall wrapper and make the function > signature nicer and easier to use for the rest of the code. Thanks for clarifying Quentin. That sounds good to me. - Kalesh > > Cheers, > Quentin