firmware: tegra: bpmp: Do not support big-endian

The CPU and BPMP inter-processor communication code is only partially
endian-aware, so it doesn't work properly when run on a big-endian CPU
anyway. Running Tegra SoCs in big-endian mode has also never been
supported, especially not on those with 64-bit ARM processors.

If big-endian support ever becomes necessary this can be added back but
will need additional fixes for completeness.

Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
Thierry Reding 2022-09-22 15:41:25 +02:00
parent 4c1e0a9735
commit 228722c519
2 changed files with 20 additions and 24 deletions

View File

@ -50,11 +50,7 @@ static int seqbuf_read(struct seqbuf *seqbuf, void *buf, size_t nbyte)
static int seqbuf_read_u32(struct seqbuf *seqbuf, u32 *v) static int seqbuf_read_u32(struct seqbuf *seqbuf, u32 *v)
{ {
int err; return seqbuf_read(seqbuf, v, 4);
err = seqbuf_read(seqbuf, v, 4);
*v = le32_to_cpu(*v);
return err;
} }
static int seqbuf_read_str(struct seqbuf *seqbuf, const char **str) static int seqbuf_read_str(struct seqbuf *seqbuf, const char **str)
@ -112,7 +108,7 @@ static int mrq_debug_open(struct tegra_bpmp *bpmp, const char *name,
u32 *fd, u32 *len, bool write) u32 *fd, u32 *len, bool write)
{ {
struct mrq_debug_request req = { struct mrq_debug_request req = {
.cmd = cpu_to_le32(write ? CMD_DEBUG_OPEN_WO : CMD_DEBUG_OPEN_RO), .cmd = write ? CMD_DEBUG_OPEN_WO : CMD_DEBUG_OPEN_RO,
}; };
struct mrq_debug_response resp; struct mrq_debug_response resp;
struct tegra_bpmp_message msg = { struct tegra_bpmp_message msg = {
@ -150,7 +146,7 @@ static int mrq_debug_open(struct tegra_bpmp *bpmp, const char *name,
static int mrq_debug_close(struct tegra_bpmp *bpmp, u32 fd) static int mrq_debug_close(struct tegra_bpmp *bpmp, u32 fd)
{ {
struct mrq_debug_request req = { struct mrq_debug_request req = {
.cmd = cpu_to_le32(CMD_DEBUG_CLOSE), .cmd = CMD_DEBUG_CLOSE,
.frd = { .frd = {
.fd = fd, .fd = fd,
}, },
@ -182,7 +178,7 @@ static int mrq_debug_read(struct tegra_bpmp *bpmp, const char *name,
char *data, size_t sz_data, u32 *nbytes) char *data, size_t sz_data, u32 *nbytes)
{ {
struct mrq_debug_request req = { struct mrq_debug_request req = {
.cmd = cpu_to_le32(CMD_DEBUG_READ), .cmd = CMD_DEBUG_READ,
}; };
struct mrq_debug_response resp; struct mrq_debug_response resp;
struct tegra_bpmp_message msg = { struct tegra_bpmp_message msg = {
@ -245,7 +241,7 @@ static int mrq_debug_write(struct tegra_bpmp *bpmp, const char *name,
uint8_t *data, size_t sz_data) uint8_t *data, size_t sz_data)
{ {
struct mrq_debug_request req = { struct mrq_debug_request req = {
.cmd = cpu_to_le32(CMD_DEBUG_WRITE) .cmd = CMD_DEBUG_WRITE
}; };
struct mrq_debug_response resp; struct mrq_debug_response resp;
struct tegra_bpmp_message msg = { struct tegra_bpmp_message msg = {
@ -308,7 +304,7 @@ static int bpmp_debug_show(struct seq_file *m, void *p)
char fnamebuf[256]; char fnamebuf[256];
const char *filename; const char *filename;
struct mrq_debug_request req = { struct mrq_debug_request req = {
.cmd = cpu_to_le32(CMD_DEBUG_READ), .cmd = CMD_DEBUG_READ,
}; };
struct mrq_debug_response resp; struct mrq_debug_response resp;
struct tegra_bpmp_message msg = { struct tegra_bpmp_message msg = {
@ -487,12 +483,12 @@ static int mrq_debugfs_read(struct tegra_bpmp *bpmp,
size_t *nbytes) size_t *nbytes)
{ {
struct mrq_debugfs_request req = { struct mrq_debugfs_request req = {
.cmd = cpu_to_le32(CMD_DEBUGFS_READ), .cmd = CMD_DEBUGFS_READ,
.fop = { .fop = {
.fnameaddr = cpu_to_le32((u32)name), .fnameaddr = (u32)name,
.fnamelen = cpu_to_le32((u32)sz_name), .fnamelen = (u32)sz_name,
.dataaddr = cpu_to_le32((u32)data), .dataaddr = (u32)data,
.datalen = cpu_to_le32((u32)sz_data), .datalen = (u32)sz_data,
}, },
}; };
struct mrq_debugfs_response resp; struct mrq_debugfs_response resp;
@ -525,12 +521,12 @@ static int mrq_debugfs_write(struct tegra_bpmp *bpmp,
dma_addr_t data, size_t sz_data) dma_addr_t data, size_t sz_data)
{ {
const struct mrq_debugfs_request req = { const struct mrq_debugfs_request req = {
.cmd = cpu_to_le32(CMD_DEBUGFS_WRITE), .cmd = CMD_DEBUGFS_WRITE,
.fop = { .fop = {
.fnameaddr = cpu_to_le32((u32)name), .fnameaddr = (u32)name,
.fnamelen = cpu_to_le32((u32)sz_name), .fnamelen = (u32)sz_name,
.dataaddr = cpu_to_le32((u32)data), .dataaddr = (u32)data,
.datalen = cpu_to_le32((u32)sz_data), .datalen = (u32)sz_data,
}, },
}; };
struct tegra_bpmp_message msg = { struct tegra_bpmp_message msg = {
@ -548,10 +544,10 @@ static int mrq_debugfs_dumpdir(struct tegra_bpmp *bpmp, dma_addr_t addr,
size_t size, size_t *nbytes) size_t size, size_t *nbytes)
{ {
const struct mrq_debugfs_request req = { const struct mrq_debugfs_request req = {
.cmd = cpu_to_le32(CMD_DEBUGFS_DUMPDIR), .cmd = CMD_DEBUGFS_DUMPDIR,
.dumpdir = { .dumpdir = {
.dataaddr = cpu_to_le32((u32)addr), .dataaddr = (u32)addr,
.datalen = cpu_to_le32((u32)size), .datalen = (u32)size,
}, },
}; };
struct mrq_debugfs_response resp; struct mrq_debugfs_response resp;

View File

@ -502,7 +502,7 @@ EXPORT_SYMBOL_GPL(tegra_bpmp_free_mrq);
bool tegra_bpmp_mrq_is_supported(struct tegra_bpmp *bpmp, unsigned int mrq) bool tegra_bpmp_mrq_is_supported(struct tegra_bpmp *bpmp, unsigned int mrq)
{ {
struct mrq_query_abi_request req = { .mrq = cpu_to_le32(mrq) }; struct mrq_query_abi_request req = { .mrq = mrq };
struct mrq_query_abi_response resp; struct mrq_query_abi_response resp;
struct tegra_bpmp_message msg = { struct tegra_bpmp_message msg = {
.mrq = MRQ_QUERY_ABI, .mrq = MRQ_QUERY_ABI,