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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 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 EF52BC433E0 for ; Fri, 3 Jul 2020 16:43:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4A36207FF for ; Fri, 3 Jul 2020 16:43:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4A36207FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jrOmC-0005rl-3y for qemu-devel@archiver.kernel.org; Fri, 03 Jul 2020 12:43:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrOct-0005ry-6x for qemu-devel@nongnu.org; Fri, 03 Jul 2020 12:33:23 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:5574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrOcr-00085A-FX for qemu-devel@nongnu.org; Fri, 03 Jul 2020 12:33:22 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 063GWLJi051730; Fri, 3 Jul 2020 12:33:18 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 322144vcnn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Jul 2020 12:33:18 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 063GWdhZ052640; Fri, 3 Jul 2020 12:33:18 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 322144vcn7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Jul 2020 12:33:18 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 063GUrqq004811; Fri, 3 Jul 2020 16:33:17 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma02dal.us.ibm.com with ESMTP id 321kkys5vb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Jul 2020 16:33:17 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 063GXD7627722228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Jul 2020 16:33:13 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CDB8F7805F; Fri, 3 Jul 2020 16:33:15 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B83E978060; Fri, 3 Jul 2020 16:33:13 +0000 (GMT) Received: from [153.66.254.194] (unknown [9.85.161.191]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 3 Jul 2020 16:33:13 +0000 (GMT) Message-ID: <1593793992.3972.33.camel@linux.ibm.com> Subject: Re: [PATCH v2] SEV: QMP support for Inject-Launch-Secret From: James Bottomley To: "Dr. David Alan Gilbert" Date: Fri, 03 Jul 2020 09:33:12 -0700 In-Reply-To: <20200703160208.GG6641@work-vm> References: <20200702194213.23272-1-tobin@linux.vnet.ibm.com> <20200703110929.GB6641@work-vm> <1593791654.3972.26.camel@linux.ibm.com> <20200703160208.GG6641@work-vm> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-03_13:2020-07-02, 2020-07-03 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 mlxscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 cotscore=-2147483648 suspectscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2007030110 Received-SPF: pass client-ip=148.163.156.1; envelope-from=jejb@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/03 11:35:39 X-ACL-Warn: Detected OS = Linux 3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: jejb@linux.ibm.com Cc: thomas.lendacky@amd.com, brijesh.singh@amd.com, tobin@ibm.com, qemu-devel@nongnu.org, Tobin Feldman-Fitzthum , pbonzini@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Fri, 2020-07-03 at 17:02 +0100, Dr. David Alan Gilbert wrote: > * James Bottomley (jejb@linux.ibm.com) wrote: > > On Fri, 2020-07-03 at 12:11 +0100, Dr. David Alan Gilbert wrote: > > > * Tobin Feldman-Fitzthum (tobin@linux.vnet.ibm.com) wrote: > > > > [...] > > > > + input.trans_uaddr = (uint64_t)data; > > > > + input.trans_len = data_sz; > > > > + > > > > + input.guest_uaddr = (uint64_t)hva; > > > > > > Thanks for changing these; although it fails a 32bit build (which > > > is probably mostly pointless for SEV, but it fails the build > > > rather than building it out). The easy fix here seems to be: > > > (uint64_t)(uintptr_t) > > > > That's a pointer width issue. The recommended way to communicate > > to the compiler that we really want to cast a 32 bit pointer to a > > 64 bit value is actually to cast to unsigned long before casting to > > pointer, so > > > > (uint64_t)(unsigned long)hva > > > > Many other things work, of course, but if you follow the > > recommendation you (hopefully) don't trip future compiler warnings. > > OK, fair enough > (Out of curiosity can you explain why unsigned long not uintptr_t?) You have to cast it to a matching variable size integer first, so both unsigned long and uintptr_t work because they're 64 bits on LP64 and 32 bits on ILP32. The only minor problem with uintptr_t is that the checker may or may not be programmed to know what it does and there's nothing more annoying than trying to get a warning message you know to be wrong fixed. James