Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753017AbbEHWb1 (ORCPT ); Fri, 8 May 2015 18:31:27 -0400 Received: from mail-ob0-f179.google.com ([209.85.214.179]:36144 "EHLO mail-ob0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751361AbbEHWbZ (ORCPT ); Fri, 8 May 2015 18:31:25 -0400 From: Ashley Lai X-Google-Original-From: Ashley Lai Date: Fri, 8 May 2015 17:31:23 -0500 (CDT) To: "Hon Ching(Vicky) Lo" cc: tpmdd-devel@lists.sourceforge.net, Peter Huewe , Ashley Lai , Mimi Zohar , Vicky Lo , linux-kernel@vger.kernel.org, Joy Latten Subject: Re: [PATCH 3/3] vTPM: support little endian guests In-Reply-To: <1430873486-25868-4-git-send-email-honclo@linux.vnet.ibm.com> Message-ID: References: <1430873486-25868-1-git-send-email-honclo@linux.vnet.ibm.com> <1430873486-25868-4-git-send-email-honclo@linux.vnet.ibm.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1619 Lines: 48 > The event log in ppc64 arch is always in big endian format. PowerPC > supports both little endian and big endian guests. This patch converts > the event log entries to guest format. I'm a little confused here. If this patch is to convert the event log entries why are we convert in the conditional statements? One example below: + if (((convert_to_host_format(event->event_type) == 0) && + (convert_to_host_format(event->event_size) == 0)) + || + ((v + sizeof(struct tcpa_event) + + convert_to_host_format(event->event_size)) > limit)) > > We defined a macro to convert to guest format. In addition, > tpm_binary_bios_measurements_show() is modified to parse the event > and print each field individually. It's nice to have human readable format but it may break existing tools that parse or understand the machine readable format. Any comments on this anyone? >> > diff --git a/drivers/char/tpm/tpm_eventlog.c b/drivers/char/tpm/tpm_eventlog.c > index e77d8c1..1b62c52 100644 > --- a/drivers/char/tpm/tpm_eventlog.c > +++ b/drivers/char/tpm/tpm_eventlog.c > @@ -28,6 +28,11 @@ > #include "tpm.h" > #include "tpm_eventlog.h" > > +#ifdef CONFIG_PPC64 > +#define convert_to_host_format(x) be32_to_cpu(x) > +#else > +#define convert_to_host_format(x) x > +#endif This can go in the header file tpm_eventlog.h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/