diff mbox series

[v2,4/4] Exclude TPM ioctls definitions for the GNU/Hurd

Message ID CAHP40m=_7zOT5bnp1FR12ohVbm-miUorh6+rrk2Rwd1jArR1VA@mail.gmail.com
State New
Headers show
Series Port qemu to GNU/Hurd | expand

Commit Message

Manolo de Medici Jan. 18, 2024, 4:04 p.m. UTC
The Hurd currently doesn't have any TPM driver, compilation fails
for missing symbols unless these are left undefined.

Signed-off-by: Manolo de Medici <manolo.demedici@gmail.com>
---
 backends/tpm/tpm_ioctl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.43.0

Comments

Peter Maydell Jan. 22, 2024, 5:16 p.m. UTC | #1
On Thu, 18 Jan 2024 at 16:04, Manolo de Medici <manolodemedici@gmail.com> wrote:
>
> The Hurd currently doesn't have any TPM driver, compilation fails
> for missing symbols unless these are left undefined.
>
> Signed-off-by: Manolo de Medici <manolo.demedici@gmail.com>
> ---
>  backends/tpm/tpm_ioctl.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
> index 1933ab6855..c721bf8847 100644
> --- a/backends/tpm/tpm_ioctl.h
> +++ b/backends/tpm/tpm_ioctl.h
> @@ -274,7 +274,7 @@ typedef struct ptm_lockstorage ptm_lockstorage;
>  #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
>  #define PTM_CAP_LOCK_STORAGE       (1 << 16)
>
> -#ifndef _WIN32
> +#if !defined(_WIN32) && !defined(__GNU__)
>  enum {
>      PTM_GET_CAPABILITY     = _IOR('P', 0, ptm_cap),
>      PTM_INIT               = _IOWR('P', 1, ptm_init),
> --
> 2.43.0

This looks plausible as a change, but looking at the history
of the file in git it seems like this is a file we import
from a third-party swtpm project.

Stefan: should we get this change made in the swtpm project
too? Or have we diverged from that copy of the header?
If the latter, then the simple thing would be to delete
this enum entirely, because as far as I can see we don't
use any of the values in QEMU, so we can avoid the
portability problem that way.

thanks
-- PMM
Stefan Berger Jan. 22, 2024, 7:30 p.m. UTC | #2
On 1/22/24 12:16, Peter Maydell wrote:
> On Thu, 18 Jan 2024 at 16:04, Manolo de Medici <manolodemedici@gmail.com> wrote:
>>
>> The Hurd currently doesn't have any TPM driver, compilation fails
>> for missing symbols unless these are left undefined.
>>
>> Signed-off-by: Manolo de Medici <manolo.demedici@gmail.com>
>> ---
>>   backends/tpm/tpm_ioctl.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
>> index 1933ab6855..c721bf8847 100644
>> --- a/backends/tpm/tpm_ioctl.h
>> +++ b/backends/tpm/tpm_ioctl.h
>> @@ -274,7 +274,7 @@ typedef struct ptm_lockstorage ptm_lockstorage;
>>   #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
>>   #define PTM_CAP_LOCK_STORAGE       (1 << 16)
>>
>> -#ifndef _WIN32
>> +#if !defined(_WIN32) && !defined(__GNU__)
>>   enum {
>>       PTM_GET_CAPABILITY     = _IOR('P', 0, ptm_cap),
>>       PTM_INIT               = _IOWR('P', 1, ptm_init),
>> --
>> 2.43.0
> 
> This looks plausible as a change, but looking at the history
> of the file in git it seems like this is a file we import
> from a third-party swtpm project.
> 
> Stefan: should we get this change made in the swtpm project
> too? Or have we diverged from that copy of the header?

The diffs are minimal at the moment:
$ diff swtpm/include/swtpm/tpm_ioctl.h qemu/backends/tpm/tpm_ioctl.h
15,16d14
< #include <stdint.h>
< #include <sys/types.h>

Since we already handle _WIN32 we can just take this case for __GNU__.

   Stefan

> If the latter, then the simple thing woud be to delete
> this enum entirely, because as far as I can see we don't
> use any of the values in QEMU, so we can avoid the
> portability problem that way.
> 
> thanks
> -- PMM
>
Peter Maydell Jan. 22, 2024, 8:46 p.m. UTC | #3
On Mon, 22 Jan 2024 at 19:30, Stefan Berger <stefanb@linux.ibm.com> wrote:
>
>
>
> On 1/22/24 12:16, Peter Maydell wrote:
> > On Thu, 18 Jan 2024 at 16:04, Manolo de Medici <manolodemedici@gmail.com> wrote:
> >>
> >> The Hurd currently doesn't have any TPM driver, compilation fails
> >> for missing symbols unless these are left undefined.
> >>
> >> Signed-off-by: Manolo de Medici <manolo.demedici@gmail.com>
> >> ---
> >>   backends/tpm/tpm_ioctl.h | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
> >> index 1933ab6855..c721bf8847 100644
> >> --- a/backends/tpm/tpm_ioctl.h
> >> +++ b/backends/tpm/tpm_ioctl.h
> >> @@ -274,7 +274,7 @@ typedef struct ptm_lockstorage ptm_lockstorage;
> >>   #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
> >>   #define PTM_CAP_LOCK_STORAGE       (1 << 16)
> >>
> >> -#ifndef _WIN32
> >> +#if !defined(_WIN32) && !defined(__GNU__)
> >>   enum {
> >>       PTM_GET_CAPABILITY     = _IOR('P', 0, ptm_cap),
> >>       PTM_INIT               = _IOWR('P', 1, ptm_init),
> >> --
> >> 2.43.0
> >
> > This looks plausible as a change, but looking at the history
> > of the file in git it seems like this is a file we import
> > from a third-party swtpm project.
> >
> > Stefan: should we get this change made in the swtpm project
> > too? Or have we diverged from that copy of the header?
>
> The diffs are minimal at the moment:
> $ diff swtpm/include/swtpm/tpm_ioctl.h qemu/backends/tpm/tpm_ioctl.h
> 15,16d14
> < #include <stdint.h>
> < #include <sys/types.h>
>
> Since we already handle _WIN32 we can just take this case for __GNU__.

OK, so how should we handle the mechanics of it -- just take
this commit in QEMU and then you'll sort it out in swtpm?
Or do we need to change swtpm first and then sync?

thanks
-- PMM
Stefan Berger Jan. 22, 2024, 9:50 p.m. UTC | #4
On 1/22/24 15:46, Peter Maydell wrote:
> On Mon, 22 Jan 2024 at 19:30, Stefan Berger <stefanb@linux.ibm.com> wrote:
>>
>>
>>
>> On 1/22/24 12:16, Peter Maydell wrote:
>>> On Thu, 18 Jan 2024 at 16:04, Manolo de Medici <manolodemedici@gmail.com> wrote:
>>>>
>>>> The Hurd currently doesn't have any TPM driver, compilation fails
>>>> for missing symbols unless these are left undefined.
>>>>
>>>> Signed-off-by: Manolo de Medici <manolo.demedici@gmail.com>
>>>> ---
>>>>    backends/tpm/tpm_ioctl.h | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
>>>> index 1933ab6855..c721bf8847 100644
>>>> --- a/backends/tpm/tpm_ioctl.h
>>>> +++ b/backends/tpm/tpm_ioctl.h
>>>> @@ -274,7 +274,7 @@ typedef struct ptm_lockstorage ptm_lockstorage;
>>>>    #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
>>>>    #define PTM_CAP_LOCK_STORAGE       (1 << 16)
>>>>
>>>> -#ifndef _WIN32
>>>> +#if !defined(_WIN32) && !defined(__GNU__)
>>>>    enum {
>>>>        PTM_GET_CAPABILITY     = _IOR('P', 0, ptm_cap),
>>>>        PTM_INIT               = _IOWR('P', 1, ptm_init),
>>>> --
>>>> 2.43.0
>>>
>>> This looks plausible as a change, but looking at the history
>>> of the file in git it seems like this is a file we import
>>> from a third-party swtpm project.
>>>
>>> Stefan: should we get this change made in the swtpm project
>>> too? Or have we diverged from that copy of the header?
>>
>> The diffs are minimal at the moment:
>> $ diff swtpm/include/swtpm/tpm_ioctl.h qemu/backends/tpm/tpm_ioctl.h
>> 15,16d14
>> < #include <stdint.h>
>> < #include <sys/types.h>
>>
>> Since we already handle _WIN32 we can just take this case for __GNU__.
> 
> OK, so how should we handle the mechanics of it -- just take
> this commit in QEMU and then you'll sort it out in swtpm?

Yes.

> Or do we need to change swtpm first and then sync?

No.

Regarding the patch:

Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>

> 
> thanks
> -- PMM
diff mbox series

Patch

diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
index 1933ab6855..c721bf8847 100644
--- a/backends/tpm/tpm_ioctl.h
+++ b/backends/tpm/tpm_ioctl.h
@@ -274,7 +274,7 @@  typedef struct ptm_lockstorage ptm_lockstorage;
 #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
 #define PTM_CAP_LOCK_STORAGE       (1 << 16)

-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__GNU__)
 enum {
     PTM_GET_CAPABILITY     = _IOR('P', 0, ptm_cap),
     PTM_INIT               = _IOWR('P', 1, ptm_init),