* [PATCH] xmm7modem: disabling reporting of intermediate results for CGDATA
From: Antara Borwankar @ 2019-06-20 12:07 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]
Setting <connect_flag> in AT+XDATACHANNEL set command to 0. This will
disable intermediate result reporting of "CONNECT" and "NO CARRIER"
on control channel.
This resolves the issue of getting failure response for offline-modem
since "NO CARRIER" is received as result of AT+CFUN operation instead
of "OK".
---
drivers/ifxmodem/gprs-context.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index 2de6b4f..7bacb73 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -406,7 +406,7 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
interface = ofono_gprs_context_get_interface(gc);
datapath = get_datapath(modem, interface);
- snprintf(buf, sizeof(buf), "AT+XDATACHANNEL=1,1,\"%s\",\"%s\",2,%u",
+ snprintf(buf, sizeof(buf), "AT+XDATACHANNEL=1,1,\"%s\",\"%s\",0,%u",
ctrlpath, datapath, gcd->active_context);
g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
snprintf(buf, sizeof(buf), "AT+CGDATA=\"M-RAW_IP\",%u",
--
1.9.1
^ permalink raw reply related
* [Xen-devel] [PATCH] x86/svm: Drop svm_vm{load,save}() helpers
From: Andrew Cooper @ 2019-06-20 12:06 UTC (permalink / raw)
To: Xen-devel
Cc: Jan Beulich, Wei Liu, Andrew Cooper, Suravee Suthikulpanit,
Boris Ostrovsky, Brian Woods, Roger Pau Monné
Following on from c/s 7d161f6537 "x86/svm: Fix svm_vmcb_dump() when used in
current context", there is now only a single user of svm_vmsave() remaining in
the tree, with all users moved to svm_vm{load,save}_pa().
nv->nv_n1vmcx has a matching nv->nv_n1vmcx_pa which is always correct, and
avoids a redundant __pa() translation behind the scenes.
With this gone, all VM{LOAD,SAVE} operations are using paddr_t's which is more
efficient, so drop the svm_vm{load,save}() helpers to avoid uses of them
reappearing in the future.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
CC: Brian Woods <brian.woods@amd.com>
It turns out I was mistaken about how complicated this was.
---
xen/arch/x86/hvm/svm/nestedsvm.c | 2 +-
xen/include/asm-x86/hvm/svm/svm.h | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 35c1a04..fef124f 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -1030,7 +1030,7 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
struct vmcb_struct *ns_vmcb = nv->nv_vvmcx;
struct vmcb_struct *n2vmcb = nv->nv_n2vmcx;
- svm_vmsave(nv->nv_n1vmcx);
+ svm_vmsave_pa(nv->nv_n1vmcx_pa);
/* Cache guest physical address of virtual vmcb
* for VMCB Cleanbit emulation.
diff --git a/xen/include/asm-x86/hvm/svm/svm.h b/xen/include/asm-x86/hvm/svm/svm.h
index 6e688a8..16a994e 100644
--- a/xen/include/asm-x86/hvm/svm/svm.h
+++ b/xen/include/asm-x86/hvm/svm/svm.h
@@ -22,9 +22,6 @@
#include <xen/types.h>
-#define svm_vmload(x) svm_vmload_pa(__pa(x))
-#define svm_vmsave(x) svm_vmsave_pa(__pa(x))
-
static inline void svm_vmload_pa(paddr_t vmcb)
{
asm volatile (
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related
* [Qemu-devel] [PATCH v2 2/3] tests/tcg: target/mips: Amend tests for MSA pack instructions
From: Aleksandar Markovic @ 2019-06-20 11:49 UTC (permalink / raw)
To: qemu-devel; +Cc: arikalo, amarkovic
In-Reply-To: <1561031359-6727-1-git-send-email-aleksandar.markovic@rt-rk.com>
From: Aleksandar Markovic <amarkovic@wavecomp.com>
Add tests for cases when destination register is the same as one
of source registers.
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
---
tests/tcg/mips/include/wrappers_msa.h | 24 +++++++++
.../tcg/mips/user/ase/msa/pack/test_msa_pckev_b.c | 58 +++++++++++++++++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckev_d.c | 58 +++++++++++++++++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckev_h.c | 58 +++++++++++++++++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckev_w.c | 58 +++++++++++++++++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckod_b.c | 58 +++++++++++++++++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckod_d.c | 58 +++++++++++++++++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckod_h.c | 58 +++++++++++++++++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckod_w.c | 58 +++++++++++++++++++++-
tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_b.c | 58 +++++++++++++++++++++-
tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_d.c | 58 +++++++++++++++++++++-
tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_h.c | 58 +++++++++++++++++++++-
tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_w.c | 58 +++++++++++++++++++++-
13 files changed, 708 insertions(+), 12 deletions(-)
diff --git a/tests/tcg/mips/include/wrappers_msa.h b/tests/tcg/mips/include/wrappers_msa.h
index 5d28cb5..9570aa8 100644
--- a/tests/tcg/mips/include/wrappers_msa.h
+++ b/tests/tcg/mips/include/wrappers_msa.h
@@ -555,19 +555,43 @@ DO_MSA__WD__WS_WT(XOR_V, xor.v)
*/
DO_MSA__WD__WS_WT(PCKEV_B, pckev.b)
+DO_MSA__WD__WD_WT(PCKEV_B__DDT, pckev.b)
+DO_MSA__WD__WS_WD(PCKEV_B__DSD, pckev.b)
DO_MSA__WD__WS_WT(PCKEV_H, pckev.h)
+DO_MSA__WD__WD_WT(PCKEV_H__DDT, pckev.h)
+DO_MSA__WD__WS_WD(PCKEV_H__DSD, pckev.h)
DO_MSA__WD__WS_WT(PCKEV_W, pckev.w)
+DO_MSA__WD__WD_WT(PCKEV_W__DDT, pckev.w)
+DO_MSA__WD__WS_WD(PCKEV_W__DSD, pckev.w)
DO_MSA__WD__WS_WT(PCKEV_D, pckev.d)
+DO_MSA__WD__WD_WT(PCKEV_D__DDT, pckev.d)
+DO_MSA__WD__WS_WD(PCKEV_D__DSD, pckev.d)
DO_MSA__WD__WS_WT(PCKOD_B, pckod.b)
+DO_MSA__WD__WD_WT(PCKOD_B__DDT, pckod.b)
+DO_MSA__WD__WS_WD(PCKOD_B__DSD, pckod.b)
DO_MSA__WD__WS_WT(PCKOD_H, pckod.h)
+DO_MSA__WD__WD_WT(PCKOD_H__DDT, pckod.h)
+DO_MSA__WD__WS_WD(PCKOD_H__DSD, pckod.h)
DO_MSA__WD__WS_WT(PCKOD_W, pckod.w)
+DO_MSA__WD__WD_WT(PCKOD_W__DDT, pckod.w)
+DO_MSA__WD__WS_WD(PCKOD_W__DSD, pckod.w)
DO_MSA__WD__WS_WT(PCKOD_D, pckod.d)
+DO_MSA__WD__WD_WT(PCKOD_D__DDT, pckod.d)
+DO_MSA__WD__WS_WD(PCKOD_D__DSD, pckod.d)
DO_MSA__WD__WS_WT(VSHF_B, vshf.b)
+DO_MSA__WD__WD_WT(VSHF_B__DDT, vshf.b)
+DO_MSA__WD__WS_WD(VSHF_B__DSD, vshf.b)
DO_MSA__WD__WS_WT(VSHF_H, vshf.h)
+DO_MSA__WD__WD_WT(VSHF_H__DDT, vshf.h)
+DO_MSA__WD__WS_WD(VSHF_H__DSD, vshf.h)
DO_MSA__WD__WS_WT(VSHF_W, vshf.w)
+DO_MSA__WD__WD_WT(VSHF_W__DDT, vshf.w)
+DO_MSA__WD__WS_WD(VSHF_W__DSD, vshf.w)
DO_MSA__WD__WS_WT(VSHF_D, vshf.d)
+DO_MSA__WD__WD_WT(VSHF_D__DDT, vshf.d)
+DO_MSA__WD__WS_WD(VSHF_D__DSD, vshf.d)
/*
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_b.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_b.c
index 70cef5b..4a4c9d6 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_b.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_b.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0xf71a3ffcbe639308ULL, 0xf1d842a04f4d314eULL, },
{ 0xd8ff2b145aaacf80ULL, 0xf1d842a04f4d314eULL, },
{ 0xf1d842a04f4d314eULL, 0xf1d842a04f4d314eULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKEV_B__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKEV_B__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_d.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_d.c
index 8a1d18f..67df606 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_d.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_d.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0xfbbe00634d93c708ULL, 0x704f164d5e31e24eULL, },
{ 0xac5aaeaab9cf8b80ULL, 0x704f164d5e31e24eULL, },
{ 0x704f164d5e31e24eULL, 0x704f164d5e31e24eULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKEV_D__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKEV_D__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_h.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_h.c
index c8636ba..22d043c 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_h.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_h.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0xbb1a52fc0063c708ULL, 0x88d8e2a0164de24eULL, },
{ 0xc6ff2514aeaa8b80ULL, 0x88d8e2a0164de24eULL, },
{ 0x88d8e2a0164de24eULL, 0x88d8e2a0164de24eULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKEV_H__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKEV_H__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_w.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_w.c
index 7ceab05..1a9c2df 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_w.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_w.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0x153f52fc4d93c708ULL, 0xa942e2a05e31e24eULL, },
{ 0xab2b2514b9cf8b80ULL, 0xa942e2a05e31e24eULL, },
{ 0xa942e2a05e31e24eULL, 0xa942e2a05e31e24eULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKEV_W__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKEV_W__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_b.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_b.c
index b6f5e08..15ef377 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_b.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_b.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0x12bb1552fb004dc7ULL, 0x8d88a9e270165ee2ULL, },
{ 0x27c6ab25acaeb98bULL, 0x8d88a9e270165ee2ULL, },
{ 0x8d88a9e270165ee2ULL, 0x8d88a9e270165ee2ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKOD_B__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKOD_B__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_d.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_d.c
index c4b2386..e3997cd 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_d.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_d.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0x12f7bb1a153f52fcULL, 0x8df188d8a942e2a0ULL, },
{ 0x27d8c6ffab2b2514ULL, 0x8df188d8a942e2a0ULL, },
{ 0x8df188d8a942e2a0ULL, 0x8df188d8a942e2a0ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKOD_D__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKOD_D__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_h.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_h.c
index 36329e7..2a29ac0 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_h.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_h.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0x12f7153ffbbe4d93ULL, 0x8df1a942704f5e31ULL, },
{ 0x27d8ab2bac5ab9cfULL, 0x8df1a942704f5e31ULL, },
{ 0x8df1a942704f5e31ULL, 0x8df1a942704f5e31ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKOD_H__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKOD_H__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_w.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_w.c
index 3bc4223..a3fbe25 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_w.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_w.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0x12f7bb1afbbe0063ULL, 0x8df188d8704f164dULL, },
{ 0x27d8c6ffac5aaeaaULL, 0x8df188d8704f164dULL, },
{ 0x8df188d8704f164dULL, 0x8df188d8704f164dULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKOD_W__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_PCKOD_W__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_b.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_b.c
index 16f63c2..eedb7d8 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_b.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_b.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x8080808080808080ULL, 0x8080808080808080ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_VSHF_B__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_VSHF_B__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_d.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_d.c
index 5033b63..85a8f0d 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_d.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_d.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xac5aaeaab9cf8b80ULL, 0xac5aaeaab9cf8b80ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_VSHF_D__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_VSHF_D__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_h.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_h.c
index 7de1f36..8d416bc 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_h.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_h.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0x8b808b808b808b80ULL, 0x8b808b808b808b80ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_VSHF_H__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_VSHF_H__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_w.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_w.c
index c19fb72..fd8f02d 100644
--- a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_w.c
+++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_w.c
@@ -28,7 +28,7 @@
#define TEST_COUNT_TOTAL ( \
(PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
- (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
int32_t main(void)
@@ -123,6 +123,38 @@ int32_t main(void)
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xb9cf8b80b9cf8b80ULL, 0xb9cf8b80b9cf8b80ULL, },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
};
reset_msa_registers();
@@ -145,6 +177,30 @@ int32_t main(void)
}
}
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_VSHF_W__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_VSHF_W__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
gettimeofday(&end, NULL);
elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
--
2.7.4
^ permalink raw reply related
* [Qemu-devel] [PATCH v2 3/3] tests/tcg: target/mips: Add tests for MSA bit move instructions
From: Aleksandar Markovic @ 2019-06-20 11:49 UTC (permalink / raw)
To: qemu-devel; +Cc: arikalo, amarkovic
In-Reply-To: <1561031359-6727-1-git-send-email-aleksandar.markovic@rt-rk.com>
From: Aleksandar Markovic <amarkovic@wavecomp.com>
Add tests for MSA bit move instructions.
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
tests/tcg/mips/include/wrappers_msa.h | 6 +
.../mips/user/ase/msa/bit-move/test_msa_bmnz_v.c | 214 +++++++++++++++++++++
.../mips/user/ase/msa/bit-move/test_msa_bmz_v.c | 214 +++++++++++++++++++++
.../mips/user/ase/msa/bit-move/test_msa_bsel_v.c | 214 +++++++++++++++++++++
4 files changed, 648 insertions(+)
create mode 100644 tests/tcg/mips/user/ase/msa/bit-move/test_msa_bmnz_v.c
create mode 100644 tests/tcg/mips/user/ase/msa/bit-move/test_msa_bmz_v.c
create mode 100644 tests/tcg/mips/user/ase/msa/bit-move/test_msa_bsel_v.c
diff --git a/tests/tcg/mips/include/wrappers_msa.h b/tests/tcg/mips/include/wrappers_msa.h
index 9570aa8..3b1a403 100644
--- a/tests/tcg/mips/include/wrappers_msa.h
+++ b/tests/tcg/mips/include/wrappers_msa.h
@@ -197,8 +197,14 @@ DO_MSA__WD__WS_WT(BINSR_W, binsr.w)
DO_MSA__WD__WS_WT(BINSR_D, binsr.d)
DO_MSA__WD__WS_WT(BMNZ_V, bmnz.v)
+DO_MSA__WD__WD_WT(BMNZ_V__DDT, bmnz.b)
+DO_MSA__WD__WS_WD(BMNZ_V__DSD, bmnz.b)
DO_MSA__WD__WS_WT(BMZ_V, bmz.v)
+DO_MSA__WD__WD_WT(BMZ_V__DDT, bmz.b)
+DO_MSA__WD__WS_WD(BMZ_V__DSD, bmz.b)
DO_MSA__WD__WS_WT(BSEL_V, bsel.v)
+DO_MSA__WD__WD_WT(BSEL_V__DDT, bsel.b)
+DO_MSA__WD__WS_WD(BSEL_V__DSD, bsel.b)
/*
diff --git a/tests/tcg/mips/user/ase/msa/bit-move/test_msa_bmnz_v.c b/tests/tcg/mips/user/ase/msa/bit-move/test_msa_bmnz_v.c
new file mode 100644
index 0000000..9b0f600
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-move/test_msa_bmnz_v.c
@@ -0,0 +1,214 @@
+/*
+ * Test program for MSA instruction BMNZ.V
+ *
+ * Copyright (C) 2019 Wave Computing, Inc.
+ * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *`
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *isa_ase_name = "MSA";
+ char *group_name = "Bit Move";
+ char *instruction_name = "BMNZ.V";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xffffffffffffffffULL, },
+ { 0x5555555555555555ULL, 0xffffffffffffffffULL, },
+ { 0xccccccccccccccccULL, 0xffffffffffffffffULL, },
+ { 0x3333333333333333ULL, 0xffffffffffffffffULL, },
+ { 0xe3388ee38ee3388eULL, 0xffffffffffffffffULL, },
+ { 0x1cc7711c711cc771ULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x0000000000000000ULL, },
+ { 0x5555555555555555ULL, 0x0000000000000000ULL, },
+ { 0xccccccccccccccccULL, 0x0000000000000000ULL, },
+ { 0x3333333333333333ULL, 0x0000000000000000ULL, },
+ { 0xe3388ee38ee3388eULL, 0x0000000000000000ULL, },
+ { 0x1cc7711c711cc771ULL, 0x0000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xccccccccccccccccULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x3333333333333333ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xe3388ee38ee3388eULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x1cc7711c711cc771ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0x5555555555555555ULL, }, /* 24 */
+ { 0x0000000000000000ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x5555555555555555ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0x5555555555555555ULL, },
+ { 0x3333333333333333ULL, 0x5555555555555555ULL, },
+ { 0xe3388ee38ee3388eULL, 0x5555555555555555ULL, },
+ { 0x1cc7711c711cc771ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xccccccccccccccccULL, }, /* 32 */
+ { 0x0000000000000000ULL, 0xccccccccccccccccULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xccccccccccccccccULL, },
+ { 0x5555555555555555ULL, 0xccccccccccccccccULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0xccccccccccccccccULL, },
+ { 0xe3388ee38ee3388eULL, 0xccccccccccccccccULL, },
+ { 0x1cc7711c711cc771ULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0x3333333333333333ULL, }, /* 40 */
+ { 0x0000000000000000ULL, 0x3333333333333333ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x3333333333333333ULL, },
+ { 0x5555555555555555ULL, 0x3333333333333333ULL, },
+ { 0xccccccccccccccccULL, 0x3333333333333333ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe3388ee38ee3388eULL, 0x3333333333333333ULL, },
+ { 0x1cc7711c711cc771ULL, 0x3333333333333333ULL, },
+ { 0xffffffffffffffffULL, 0xe3388ee38ee3388eULL, }, /* 48 */
+ { 0x0000000000000000ULL, 0xe3388ee38ee3388eULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xe3388ee38ee3388eULL, },
+ { 0x5555555555555555ULL, 0xe3388ee38ee3388eULL, },
+ { 0xccccccccccccccccULL, 0xe3388ee38ee3388eULL, },
+ { 0x3333333333333333ULL, 0xe3388ee38ee3388eULL, },
+ { 0xe3388ee38ee3388eULL, 0xe3388ee38ee3388eULL, },
+ { 0x1cc7711c711cc771ULL, 0xe3388ee38ee3388eULL, },
+ { 0xffffffffffffffffULL, 0x1cc7711c711cc771ULL, }, /* 56 */
+ { 0x0000000000000000ULL, 0x1cc7711c711cc771ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x1cc7711c711cc771ULL, },
+ { 0x5555555555555555ULL, 0x1cc7711c711cc771ULL, },
+ { 0xccccccccccccccccULL, 0x1cc7711c711cc771ULL, },
+ { 0x3333333333333333ULL, 0x1cc7711c711cc771ULL, },
+ { 0xe3388ee38ee3388eULL, 0x1cc7711c711cc771ULL, },
+ { 0x1cc7711c711cc771ULL, 0x1cc7711c711cc771ULL, },
+ { 0x675e7b0c6acc6240ULL, 0x675e7b0c6acc6240ULL, }, /* 64 */
+ { 0xf71a3ffcbe639308ULL, 0x675e7b0c6acc6240ULL, },
+ { 0xd8ff2b145aaacf80ULL, 0x675e7b0c6acc6240ULL, },
+ { 0xf1d842a04f4d314eULL, 0x675e7b0c6acc6240ULL, },
+ { 0x675e7b0c6acc6240ULL, 0xf71a3ffcbe639308ULL, },
+ { 0xf71a3ffcbe639308ULL, 0xf71a3ffcbe639308ULL, },
+ { 0xd8ff2b145aaacf80ULL, 0xf71a3ffcbe639308ULL, },
+ { 0xf1d842a04f4d314eULL, 0xf71a3ffcbe639308ULL, },
+ { 0x675e7b0c6acc6240ULL, 0xd8ff2b145aaacf80ULL, }, /* 72 */
+ { 0xf71a3ffcbe639308ULL, 0xd8ff2b145aaacf80ULL, },
+ { 0xd8ff2b145aaacf80ULL, 0xd8ff2b145aaacf80ULL, },
+ { 0xf1d842a04f4d314eULL, 0xd8ff2b145aaacf80ULL, },
+ { 0x675e7b0c6acc6240ULL, 0xf1d842a04f4d314eULL, },
+ { 0xf71a3ffcbe639308ULL, 0xf1d842a04f4d314eULL, },
+ { 0xd8ff2b145aaacf80ULL, 0xf1d842a04f4d314eULL, },
+ { 0xf1d842a04f4d314eULL, 0xf1d842a04f4d314eULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ };
+
+ reset_msa_registers();
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BMNZ_V(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BMNZ_V(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BMNZ_V__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BMNZ_V__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results_128(isa_ase_name, group_name, instruction_name,
+ TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/bit-move/test_msa_bmz_v.c b/tests/tcg/mips/user/ase/msa/bit-move/test_msa_bmz_v.c
new file mode 100644
index 0000000..dea384e
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-move/test_msa_bmz_v.c
@@ -0,0 +1,214 @@
+/*
+ * Test program for MSA instruction BMZ.V
+ *
+ * Copyright (C) 2019 Wave Computing, Inc.
+ * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *`
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *isa_ase_name = "MSA";
+ char *group_name = "Bit Move";
+ char *instruction_name = "BMZ.V";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xffffffffffffffffULL, },
+ { 0x5555555555555555ULL, 0xffffffffffffffffULL, },
+ { 0xccccccccccccccccULL, 0xffffffffffffffffULL, },
+ { 0x3333333333333333ULL, 0xffffffffffffffffULL, },
+ { 0xe3388ee38ee3388eULL, 0xffffffffffffffffULL, },
+ { 0x1cc7711c711cc771ULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x0000000000000000ULL, },
+ { 0x5555555555555555ULL, 0x0000000000000000ULL, },
+ { 0xccccccccccccccccULL, 0x0000000000000000ULL, },
+ { 0x3333333333333333ULL, 0x0000000000000000ULL, },
+ { 0xe3388ee38ee3388eULL, 0x0000000000000000ULL, },
+ { 0x1cc7711c711cc771ULL, 0x0000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xccccccccccccccccULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x3333333333333333ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xe3388ee38ee3388eULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x1cc7711c711cc771ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0x5555555555555555ULL, }, /* 24 */
+ { 0x0000000000000000ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x5555555555555555ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0x5555555555555555ULL, },
+ { 0x3333333333333333ULL, 0x5555555555555555ULL, },
+ { 0xe3388ee38ee3388eULL, 0x5555555555555555ULL, },
+ { 0x1cc7711c711cc771ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xccccccccccccccccULL, }, /* 32 */
+ { 0x0000000000000000ULL, 0xccccccccccccccccULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xccccccccccccccccULL, },
+ { 0x5555555555555555ULL, 0xccccccccccccccccULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0xccccccccccccccccULL, },
+ { 0xe3388ee38ee3388eULL, 0xccccccccccccccccULL, },
+ { 0x1cc7711c711cc771ULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0x3333333333333333ULL, }, /* 40 */
+ { 0x0000000000000000ULL, 0x3333333333333333ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x3333333333333333ULL, },
+ { 0x5555555555555555ULL, 0x3333333333333333ULL, },
+ { 0xccccccccccccccccULL, 0x3333333333333333ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe3388ee38ee3388eULL, 0x3333333333333333ULL, },
+ { 0x1cc7711c711cc771ULL, 0x3333333333333333ULL, },
+ { 0xffffffffffffffffULL, 0xe3388ee38ee3388eULL, }, /* 48 */
+ { 0x0000000000000000ULL, 0xe3388ee38ee3388eULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xe3388ee38ee3388eULL, },
+ { 0x5555555555555555ULL, 0xe3388ee38ee3388eULL, },
+ { 0xccccccccccccccccULL, 0xe3388ee38ee3388eULL, },
+ { 0x3333333333333333ULL, 0xe3388ee38ee3388eULL, },
+ { 0xe3388ee38ee3388eULL, 0xe3388ee38ee3388eULL, },
+ { 0x1cc7711c711cc771ULL, 0xe3388ee38ee3388eULL, },
+ { 0xffffffffffffffffULL, 0x1cc7711c711cc771ULL, }, /* 56 */
+ { 0x0000000000000000ULL, 0x1cc7711c711cc771ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x1cc7711c711cc771ULL, },
+ { 0x5555555555555555ULL, 0x1cc7711c711cc771ULL, },
+ { 0xccccccccccccccccULL, 0x1cc7711c711cc771ULL, },
+ { 0x3333333333333333ULL, 0x1cc7711c711cc771ULL, },
+ { 0xe3388ee38ee3388eULL, 0x1cc7711c711cc771ULL, },
+ { 0x1cc7711c711cc771ULL, 0x1cc7711c711cc771ULL, },
+ { 0x675e7b0c6acc6240ULL, 0x675e7b0c6acc6240ULL, }, /* 64 */
+ { 0xf71a3ffcbe639308ULL, 0x675e7b0c6acc6240ULL, },
+ { 0xd8ff2b145aaacf80ULL, 0x675e7b0c6acc6240ULL, },
+ { 0xf1d842a04f4d314eULL, 0x675e7b0c6acc6240ULL, },
+ { 0x675e7b0c6acc6240ULL, 0xf71a3ffcbe639308ULL, },
+ { 0xf71a3ffcbe639308ULL, 0xf71a3ffcbe639308ULL, },
+ { 0xd8ff2b145aaacf80ULL, 0xf71a3ffcbe639308ULL, },
+ { 0xf1d842a04f4d314eULL, 0xf71a3ffcbe639308ULL, },
+ { 0x675e7b0c6acc6240ULL, 0xd8ff2b145aaacf80ULL, }, /* 72 */
+ { 0xf71a3ffcbe639308ULL, 0xd8ff2b145aaacf80ULL, },
+ { 0xd8ff2b145aaacf80ULL, 0xd8ff2b145aaacf80ULL, },
+ { 0xf1d842a04f4d314eULL, 0xd8ff2b145aaacf80ULL, },
+ { 0x675e7b0c6acc6240ULL, 0xf1d842a04f4d314eULL, },
+ { 0xf71a3ffcbe639308ULL, 0xf1d842a04f4d314eULL, },
+ { 0xd8ff2b145aaacf80ULL, 0xf1d842a04f4d314eULL, },
+ { 0xf1d842a04f4d314eULL, 0xf1d842a04f4d314eULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ };
+
+ reset_msa_registers();
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BMZ_V(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BMZ_V(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BMZ_V__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BMZ_V__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results_128(isa_ase_name, group_name, instruction_name,
+ TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/bit-move/test_msa_bsel_v.c b/tests/tcg/mips/user/ase/msa/bit-move/test_msa_bsel_v.c
new file mode 100644
index 0000000..ca1c389
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-move/test_msa_bsel_v.c
@@ -0,0 +1,214 @@
+/*
+ * Test program for MSA instruction BSEL.V
+ *
+ * Copyright (C) 2019 Wave Computing, Inc.
+ * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *`
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *isa_ase_name = "MSA";
+ char *group_name = "Bit Move";
+ char *instruction_name = "BSEL.V";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xffffffffffffffffULL, },
+ { 0x5555555555555555ULL, 0xffffffffffffffffULL, },
+ { 0xccccccccccccccccULL, 0xffffffffffffffffULL, },
+ { 0x3333333333333333ULL, 0xffffffffffffffffULL, },
+ { 0xe3388ee38ee3388eULL, 0xffffffffffffffffULL, },
+ { 0x1cc7711c711cc771ULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x0000000000000000ULL, },
+ { 0x5555555555555555ULL, 0x0000000000000000ULL, },
+ { 0xccccccccccccccccULL, 0x0000000000000000ULL, },
+ { 0x3333333333333333ULL, 0x0000000000000000ULL, },
+ { 0xe3388ee38ee3388eULL, 0x0000000000000000ULL, },
+ { 0x1cc7711c711cc771ULL, 0x0000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xccccccccccccccccULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x3333333333333333ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xe3388ee38ee3388eULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x1cc7711c711cc771ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0x5555555555555555ULL, }, /* 24 */
+ { 0x0000000000000000ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x5555555555555555ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0x5555555555555555ULL, },
+ { 0x3333333333333333ULL, 0x5555555555555555ULL, },
+ { 0xe3388ee38ee3388eULL, 0x5555555555555555ULL, },
+ { 0x1cc7711c711cc771ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xccccccccccccccccULL, }, /* 32 */
+ { 0x0000000000000000ULL, 0xccccccccccccccccULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xccccccccccccccccULL, },
+ { 0x5555555555555555ULL, 0xccccccccccccccccULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0xccccccccccccccccULL, },
+ { 0xe3388ee38ee3388eULL, 0xccccccccccccccccULL, },
+ { 0x1cc7711c711cc771ULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0x3333333333333333ULL, }, /* 40 */
+ { 0x0000000000000000ULL, 0x3333333333333333ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x3333333333333333ULL, },
+ { 0x5555555555555555ULL, 0x3333333333333333ULL, },
+ { 0xccccccccccccccccULL, 0x3333333333333333ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe3388ee38ee3388eULL, 0x3333333333333333ULL, },
+ { 0x1cc7711c711cc771ULL, 0x3333333333333333ULL, },
+ { 0xffffffffffffffffULL, 0xe3388ee38ee3388eULL, }, /* 48 */
+ { 0x0000000000000000ULL, 0xe3388ee38ee3388eULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xe3388ee38ee3388eULL, },
+ { 0x5555555555555555ULL, 0xe3388ee38ee3388eULL, },
+ { 0xccccccccccccccccULL, 0xe3388ee38ee3388eULL, },
+ { 0x3333333333333333ULL, 0xe3388ee38ee3388eULL, },
+ { 0xe3388ee38ee3388eULL, 0xe3388ee38ee3388eULL, },
+ { 0x1cc7711c711cc771ULL, 0xe3388ee38ee3388eULL, },
+ { 0xffffffffffffffffULL, 0x1cc7711c711cc771ULL, }, /* 56 */
+ { 0x0000000000000000ULL, 0x1cc7711c711cc771ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x1cc7711c711cc771ULL, },
+ { 0x5555555555555555ULL, 0x1cc7711c711cc771ULL, },
+ { 0xccccccccccccccccULL, 0x1cc7711c711cc771ULL, },
+ { 0x3333333333333333ULL, 0x1cc7711c711cc771ULL, },
+ { 0xe3388ee38ee3388eULL, 0x1cc7711c711cc771ULL, },
+ { 0x1cc7711c711cc771ULL, 0x1cc7711c711cc771ULL, },
+ { 0x675e7b0c6acc6240ULL, 0x675e7b0c6acc6240ULL, }, /* 64 */
+ { 0xf71a3ffcbe639308ULL, 0x675e7b0c6acc6240ULL, },
+ { 0xd8ff2b145aaacf80ULL, 0x675e7b0c6acc6240ULL, },
+ { 0xf1d842a04f4d314eULL, 0x675e7b0c6acc6240ULL, },
+ { 0x675e7b0c6acc6240ULL, 0xf71a3ffcbe639308ULL, },
+ { 0xf71a3ffcbe639308ULL, 0xf71a3ffcbe639308ULL, },
+ { 0xd8ff2b145aaacf80ULL, 0xf71a3ffcbe639308ULL, },
+ { 0xf1d842a04f4d314eULL, 0xf71a3ffcbe639308ULL, },
+ { 0x675e7b0c6acc6240ULL, 0xd8ff2b145aaacf80ULL, }, /* 72 */
+ { 0xf71a3ffcbe639308ULL, 0xd8ff2b145aaacf80ULL, },
+ { 0xd8ff2b145aaacf80ULL, 0xd8ff2b145aaacf80ULL, },
+ { 0xf1d842a04f4d314eULL, 0xd8ff2b145aaacf80ULL, },
+ { 0x675e7b0c6acc6240ULL, 0xf1d842a04f4d314eULL, },
+ { 0xf71a3ffcbe639308ULL, 0xf1d842a04f4d314eULL, },
+ { 0xd8ff2b145aaacf80ULL, 0xf1d842a04f4d314eULL, },
+ { 0xf1d842a04f4d314eULL, 0xf1d842a04f4d314eULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 80 */
+ { 0x00000000fc000000ULL, 0x000015000000001aULL, },
+ { 0x0000000014000000ULL, 0x0000ab00000000ffULL, },
+ { 0x00000000a0000000ULL, 0x0000a900000000d8ULL, },
+ { 0x000040000000000cULL, 0x9300003f00120000ULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000800000000014ULL, 0x9300003f00120000ULL, },
+ { 0x00004e00000000a0ULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0x8800000000fee6aaULL, }, /* 88 */
+ { 0x0000000000000000ULL, 0xfb000000001500aaULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x0000000000000000ULL, 0x7000000000a916aaULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 96 */
+ { 0x00000800000000fcULL, 0x6200007be64b0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeccULL, },
+ { 0x00006a0000550000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x9300003f00120000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae63ULL, },
+ { 0x0000be0000c70000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, }, /* 104 */
+ { 0x00000800000000fcULL, 0xcf00002bae270000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abaeaaULL, },
+ { 0x00005a00008b0000ULL, 0x0000000000000000ULL, },
+ { 0x000000000c000000ULL, 0x0000fe000000005eULL, },
+ { 0x00000800000000fcULL, 0x31000042168d0000ULL, },
+ { 0x0000000000000000ULL, 0xac00000000abae4dULL, },
+ { 0x00004f0000e20000ULL, 0x0000000000000000ULL, },
+ };
+
+ reset_msa_registers();
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BSEL_V(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BSEL_V(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BSEL_V__DDT(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ ((RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_BSEL_V__DSD(b128_random[i], b128_random[j],
+ b128_result[
+ ((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+ (RANDOM_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results_128(isa_ase_name, group_name, instruction_name,
+ TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
--
2.7.4
^ permalink raw reply related
* Re: [PATCH bpf] samples/bpf: xdp_redirect, correctly get dummy program id
From: Toke Høiland-Jørgensen @ 2019-06-20 11:57 UTC (permalink / raw)
To: Prashant Bhole, Alexei Starovoitov, Daniel Borkmann
Cc: Prashant Bhole, netdev, bpf
In-Reply-To: <20190620065815.7698-1-prashantbhole.linux@gmail.com>
Prashant Bhole <prashantbhole.linux@gmail.com> writes:
> When we terminate xdp_redirect, it ends up with following message:
> "Program on iface OUT changed, not removing"
> This results in dummy prog still attached to OUT interface.
> It is because signal handler checks if the programs are the same that
> we had attached. But while fetching dummy_prog_id, current code uses
> prog_fd instead of dummy_prog_fd. This patch passes the correct fd.
>
> Fixes: 3b7a8ec2dec3 ("samples/bpf: Check the prog id before exiting")
> Signed-off-by: Prashant Bhole <prashantbhole.linux@gmail.com>
Huh, I seem to recall fixing this for the other example program, but
guess I missed this one.
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
^ permalink raw reply
* Re: [PATCH v17 01/10] hw/arm/virt: Add RAS platform version for migration
From: Igor Mammedov @ 2019-06-20 12:04 UTC (permalink / raw)
To: Dongjiu Geng
Cc: pbonzini, mst, shannon.zhaosl, peter.maydell, lersek, james.morse,
mtosatti, rth, ehabkost, zhengxiang9, jonathan.cameron, xuwei5,
kvm, qemu-devel, qemu-arm, linuxarm
In-Reply-To: <1557832703-42620-2-git-send-email-gengdongjiu@huawei.com>
On Tue, 14 May 2019 04:18:14 -0700
Dongjiu Geng <gengdongjiu@huawei.com> wrote:
> Support this feature since version 4.1, disable it by
> default in the old version.
>
> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
> ---
> hw/arm/virt.c | 6 ++++++
> include/hw/arm/virt.h | 1 +
> 2 files changed, 7 insertions(+)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 5331ab7..7bdd41b 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -2043,8 +2043,14 @@ DEFINE_VIRT_MACHINE_AS_LATEST(4, 1)
>
> static void virt_machine_4_0_options(MachineClass *mc)
> {
> + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
> +
> virt_machine_4_1_options(mc);
> compat_props_add(mc->compat_props, hw_compat_4_0, hw_compat_4_0_len);
> + /* Disable memory recovery feature for 4.0 as RAS support was
> + * introduced with 4.1.
> + */
> + vmc->no_ras = true;
So it would mean that the feature is enabled unconditionally for
new machine types and consumes resources whether user needs it or not.
In light of the race for leaner QEMU and faster startup times,
it might be better to make RAS optional and make user explicitly
enable it using a machine option.
> }
> DEFINE_VIRT_MACHINE(4, 0)
>
> diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
> index 4240709..7f1a033 100644
> --- a/include/hw/arm/virt.h
> +++ b/include/hw/arm/virt.h
> @@ -104,6 +104,7 @@ typedef struct {
> bool disallow_affinity_adjustment;
> bool no_its;
> bool no_pmu;
> + bool no_ras;
> bool claim_edge_triggered_timers;
> bool smbios_old_sys_ver;
> bool no_highmem_ecam;
^ permalink raw reply
* Re: [PATCH RFC] proc/meminfo: add NetBuffers counter for socket buffers
From: Vlastimil Babka @ 2019-06-20 12:03 UTC (permalink / raw)
To: Konstantin Khlebnikov, linux-mm, linux-kernel, netdev
In-Reply-To: <155792134187.1641.3858215257559626632.stgit@buzz>
On 5/15/19 1:55 PM, Konstantin Khlebnikov wrote:
> Socket buffers always were dark-matter that lives by its own rules.
Is the information even exported somewhere e.g. in sysfs or via netlink yet?
> This patch adds line NetBuffers that exposes most common kinds of them.
Did you encounter a situation where the number was significant and this
would help finding out why memory is occupied?
> TCP and UDP are most important species.
> SCTP is added as example of modular protocol.
> UNIX have no memory counter for now, should be easy to add.
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Right now it's a sum of a few values, which should be fine wrt
/proc/meminfo overhead. But I guess netdev guys should have a say in
this. Also you should update the corresponding Documentation/ file.
Thanks,
Vlastimil
> ---
> fs/proc/meminfo.c | 5 ++++-
> include/linux/mm.h | 6 ++++++
> mm/page_alloc.c | 3 ++-
> net/core/sock.c | 20 ++++++++++++++++++++
> net/sctp/socket.c | 2 +-
> 5 files changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
> index 7bc14716fc5d..0ee2300a916d 100644
> --- a/fs/proc/meminfo.c
> +++ b/fs/proc/meminfo.c
> @@ -41,6 +41,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
> unsigned long sreclaimable, sunreclaim, misc_reclaimable;
> unsigned long kernel_stack_kb, page_tables, percpu_pages;
> unsigned long anon_pages, file_pages, swap_cached;
> + unsigned long net_buffers;
> long kernel_misc;
> int lru;
>
> @@ -66,12 +67,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
> kernel_stack_kb = global_zone_page_state(NR_KERNEL_STACK_KB);
> page_tables = global_zone_page_state(NR_PAGETABLE);
> percpu_pages = pcpu_nr_pages();
> + net_buffers = total_netbuffer_pages();
>
> /* all other kinds of kernel memory allocations */
> kernel_misc = i.totalram - i.freeram - anon_pages - file_pages
> - sreclaimable - sunreclaim - misc_reclaimable
> - (kernel_stack_kb >> (PAGE_SHIFT - 10))
> - - page_tables - percpu_pages;
> + - page_tables - percpu_pages - net_buffers;
> if (kernel_misc < 0)
> kernel_misc = 0;
>
> @@ -137,6 +139,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
> show_val_kb(m, "VmallocUsed: ", 0ul);
> show_val_kb(m, "VmallocChunk: ", 0ul);
> show_val_kb(m, "Percpu: ", percpu_pages);
> + show_val_kb(m, "NetBuffers: ", net_buffers);
> show_val_kb(m, "KernelMisc: ", kernel_misc);
>
> #ifdef CONFIG_MEMORY_FAILURE
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 0e8834ac32b7..d0a58355bfb7 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2254,6 +2254,12 @@ extern void si_meminfo_node(struct sysinfo *val, int nid);
> extern unsigned long arch_reserved_kernel_pages(void);
> #endif
>
> +#ifdef CONFIG_NET
> +extern unsigned long total_netbuffer_pages(void);
> +#else
> +static inline unsigned long total_netbuffer_pages(void) { return 0; }
> +#endif
> +
> extern __printf(3, 4)
> void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...);
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 3b13d3914176..fcdd7c6e72b9 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5166,7 +5166,7 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
> " active_file:%lu inactive_file:%lu isolated_file:%lu\n"
> " unevictable:%lu dirty:%lu writeback:%lu unstable:%lu\n"
> " slab_reclaimable:%lu slab_unreclaimable:%lu\n"
> - " mapped:%lu shmem:%lu pagetables:%lu bounce:%lu\n"
> + " mapped:%lu shmem:%lu pagetables:%lu bounce:%lu net_buffers:%lu\n"
> " free:%lu free_pcp:%lu free_cma:%lu\n",
> global_node_page_state(NR_ACTIVE_ANON),
> global_node_page_state(NR_INACTIVE_ANON),
> @@ -5184,6 +5184,7 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
> global_node_page_state(NR_SHMEM),
> global_zone_page_state(NR_PAGETABLE),
> global_zone_page_state(NR_BOUNCE),
> + total_netbuffer_pages(),
> global_zone_page_state(NR_FREE_PAGES),
> free_pcp,
> global_zone_page_state(NR_FREE_CMA_PAGES));
> diff --git a/net/core/sock.c b/net/core/sock.c
> index 75b1c950b49f..dfca4e024b74 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -142,6 +142,7 @@
> #include <trace/events/sock.h>
>
> #include <net/tcp.h>
> +#include <net/udp.h>
> #include <net/busy_poll.h>
>
> static DEFINE_MUTEX(proto_list_mutex);
> @@ -3573,3 +3574,22 @@ bool sk_busy_loop_end(void *p, unsigned long start_time)
> }
> EXPORT_SYMBOL(sk_busy_loop_end);
> #endif /* CONFIG_NET_RX_BUSY_POLL */
> +
> +#if IS_ENABLED(CONFIG_IP_SCTP)
> +atomic_long_t sctp_memory_allocated;
> +EXPORT_SYMBOL_GPL(sctp_memory_allocated);
> +#endif
> +
> +unsigned long total_netbuffer_pages(void)
> +{
> + unsigned long ret = 0;
> +
> +#if IS_ENABLED(CONFIG_IP_SCTP)
> + ret += atomic_long_read(&sctp_memory_allocated);
> +#endif
> +#ifdef CONFIG_INET
> + ret += atomic_long_read(&tcp_memory_allocated);
> + ret += atomic_long_read(&udp_memory_allocated);
> +#endif
> + return ret;
> +}
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index e4e892cc5644..9d11afdeeae4 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -107,7 +107,7 @@ static int sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
> enum sctp_socket_type type);
>
> static unsigned long sctp_memory_pressure;
> -static atomic_long_t sctp_memory_allocated;
> +extern atomic_long_t sctp_memory_allocated;
> struct percpu_counter sctp_sockets_allocated;
>
> static void sctp_enter_memory_pressure(struct sock *sk)
>
^ permalink raw reply
* [Qemu-devel] [PATCH v2 0/3] target/mips: Improve MSA tests
From: Aleksandar Markovic @ 2019-06-20 11:49 UTC (permalink / raw)
To: qemu-devel; +Cc: arikalo, amarkovic
From: Aleksandar Markovic <amarkovic@wavecomp.com>
This series contains various improvements and additions of MSA ASE
TCG tests.
v1-v2:
- added some tests from bit move group
- improved and updated commit messages
Aleksandar Markovic (3):
tests/tcg: target/mips: Include isa/ase and group name in test output
tests/tcg: target/mips: Amend tests for MSA pack instructions
tests/tcg: target/mips: Add tests for MSA bit move instructions
tests/tcg/mips/include/test_utils_128.h | 17 +-
tests/tcg/mips/include/test_utils_64.h | 9 +-
tests/tcg/mips/include/wrappers_msa.h | 30 +++
.../mips/user/ase/msa/bit-count/test_msa_nloc_b.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_nloc_d.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_nloc_h.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_nloc_w.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_nlzc_b.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_nlzc_d.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_nlzc_h.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_nlzc_w.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_pcnt_b.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_pcnt_d.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_pcnt_h.c | 9 +-
.../mips/user/ase/msa/bit-count/test_msa_pcnt_w.c | 9 +-
.../mips/user/ase/msa/bit-move/test_msa_bmnz_v.c | 214 +++++++++++++++++++++
.../mips/user/ase/msa/bit-move/test_msa_bmz_v.c | 214 +++++++++++++++++++++
.../mips/user/ase/msa/bit-move/test_msa_bsel_v.c | 214 +++++++++++++++++++++
.../mips/user/ase/msa/bit-set/test_msa_bclr_b.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bclr_d.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bclr_h.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bclr_w.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bneg_b.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bneg_d.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bneg_h.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bneg_w.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bset_b.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bset_d.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bset_h.c | 9 +-
.../mips/user/ase/msa/bit-set/test_msa_bset_w.c | 9 +-
.../user/ase/msa/fixed-multiply/test_msa_mul_q_h.c | 9 +-
.../user/ase/msa/fixed-multiply/test_msa_mul_q_w.c | 9 +-
.../ase/msa/fixed-multiply/test_msa_mulr_q_h.c | 9 +-
.../ase/msa/fixed-multiply/test_msa_mulr_q_w.c | 9 +-
.../user/ase/msa/float-max-min/test_msa_fmax_a_d.c | 9 +-
.../user/ase/msa/float-max-min/test_msa_fmax_a_w.c | 9 +-
.../user/ase/msa/float-max-min/test_msa_fmax_d.c | 9 +-
.../user/ase/msa/float-max-min/test_msa_fmax_w.c | 9 +-
.../user/ase/msa/float-max-min/test_msa_fmin_a_d.c | 9 +-
.../user/ase/msa/float-max-min/test_msa_fmin_a_w.c | 9 +-
.../user/ase/msa/float-max-min/test_msa_fmin_d.c | 9 +-
.../user/ase/msa/float-max-min/test_msa_fmin_w.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_add_a_b.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_add_a_d.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_add_a_h.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_add_a_w.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_a_b.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_a_d.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_a_h.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_a_w.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_s_b.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_s_d.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_s_h.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_s_w.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_u_b.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_u_d.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_u_h.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_adds_u_w.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_addv_b.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_addv_d.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_addv_h.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_addv_w.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_hadd_s_d.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_hadd_s_h.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_hadd_s_w.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_hadd_u_d.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_hadd_u_h.c | 9 +-
.../mips/user/ase/msa/int-add/test_msa_hadd_u_w.c | 9 +-
.../user/ase/msa/int-average/test_msa_ave_s_b.c | 9 +-
.../user/ase/msa/int-average/test_msa_ave_s_d.c | 9 +-
.../user/ase/msa/int-average/test_msa_ave_s_h.c | 9 +-
.../user/ase/msa/int-average/test_msa_ave_s_w.c | 9 +-
.../user/ase/msa/int-average/test_msa_ave_u_b.c | 9 +-
.../user/ase/msa/int-average/test_msa_ave_u_d.c | 9 +-
.../user/ase/msa/int-average/test_msa_ave_u_h.c | 9 +-
.../user/ase/msa/int-average/test_msa_ave_u_w.c | 9 +-
.../user/ase/msa/int-average/test_msa_aver_s_b.c | 9 +-
.../user/ase/msa/int-average/test_msa_aver_s_d.c | 9 +-
.../user/ase/msa/int-average/test_msa_aver_s_h.c | 9 +-
.../user/ase/msa/int-average/test_msa_aver_s_w.c | 9 +-
.../user/ase/msa/int-average/test_msa_aver_u_b.c | 9 +-
.../user/ase/msa/int-average/test_msa_aver_u_d.c | 9 +-
.../user/ase/msa/int-average/test_msa_aver_u_h.c | 9 +-
.../user/ase/msa/int-average/test_msa_aver_u_w.c | 9 +-
.../mips/user/ase/msa/int-compare/test_msa_ceq_b.c | 9 +-
.../mips/user/ase/msa/int-compare/test_msa_ceq_d.c | 9 +-
.../mips/user/ase/msa/int-compare/test_msa_ceq_h.c | 9 +-
.../mips/user/ase/msa/int-compare/test_msa_ceq_w.c | 9 +-
.../user/ase/msa/int-compare/test_msa_cle_s_b.c | 9 +-
.../user/ase/msa/int-compare/test_msa_cle_s_d.c | 9 +-
.../user/ase/msa/int-compare/test_msa_cle_s_h.c | 9 +-
.../user/ase/msa/int-compare/test_msa_cle_s_w.c | 9 +-
.../user/ase/msa/int-compare/test_msa_cle_u_b.c | 9 +-
.../user/ase/msa/int-compare/test_msa_cle_u_d.c | 9 +-
.../user/ase/msa/int-compare/test_msa_cle_u_h.c | 9 +-
.../user/ase/msa/int-compare/test_msa_cle_u_w.c | 9 +-
.../user/ase/msa/int-compare/test_msa_clt_s_b.c | 9 +-
.../user/ase/msa/int-compare/test_msa_clt_s_d.c | 9 +-
.../user/ase/msa/int-compare/test_msa_clt_s_h.c | 9 +-
.../user/ase/msa/int-compare/test_msa_clt_s_w.c | 9 +-
.../user/ase/msa/int-compare/test_msa_clt_u_b.c | 9 +-
.../user/ase/msa/int-compare/test_msa_clt_u_d.c | 9 +-
.../user/ase/msa/int-compare/test_msa_clt_u_h.c | 9 +-
.../user/ase/msa/int-compare/test_msa_clt_u_w.c | 9 +-
.../user/ase/msa/int-divide/test_msa_div_s_b.c | 9 +-
.../user/ase/msa/int-divide/test_msa_div_s_d.c | 9 +-
.../user/ase/msa/int-divide/test_msa_div_s_h.c | 9 +-
.../user/ase/msa/int-divide/test_msa_div_s_w.c | 9 +-
.../user/ase/msa/int-divide/test_msa_div_u_b.c | 9 +-
.../user/ase/msa/int-divide/test_msa_div_u_d.c | 9 +-
.../user/ase/msa/int-divide/test_msa_div_u_h.c | 9 +-
.../user/ase/msa/int-divide/test_msa_div_u_w.c | 9 +-
.../ase/msa/int-dot-product/test_msa_dotp_s_d.c | 9 +-
.../ase/msa/int-dot-product/test_msa_dotp_s_h.c | 9 +-
.../ase/msa/int-dot-product/test_msa_dotp_s_w.c | 9 +-
.../ase/msa/int-dot-product/test_msa_dotp_u_d.c | 9 +-
.../ase/msa/int-dot-product/test_msa_dotp_u_h.c | 9 +-
.../ase/msa/int-dot-product/test_msa_dotp_u_w.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_a_b.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_a_d.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_a_h.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_a_w.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_s_b.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_s_d.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_s_h.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_s_w.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_u_b.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_u_d.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_u_h.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_max_u_w.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_a_b.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_a_d.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_a_h.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_a_w.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_s_b.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_s_d.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_s_h.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_s_w.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_u_b.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_u_d.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_u_h.c | 9 +-
.../user/ase/msa/int-max-min/test_msa_min_u_w.c | 9 +-
.../user/ase/msa/int-modulo/test_msa_mod_s_b.c | 9 +-
.../user/ase/msa/int-modulo/test_msa_mod_s_d.c | 9 +-
.../user/ase/msa/int-modulo/test_msa_mod_s_h.c | 9 +-
.../user/ase/msa/int-modulo/test_msa_mod_s_w.c | 9 +-
.../user/ase/msa/int-modulo/test_msa_mod_u_b.c | 9 +-
.../user/ase/msa/int-modulo/test_msa_mod_u_d.c | 9 +-
.../user/ase/msa/int-modulo/test_msa_mod_u_h.c | 9 +-
.../user/ase/msa/int-modulo/test_msa_mod_u_w.c | 9 +-
.../user/ase/msa/int-multiply/test_msa_mulv_b.c | 9 +-
.../user/ase/msa/int-multiply/test_msa_mulv_d.c | 9 +-
.../user/ase/msa/int-multiply/test_msa_mulv_h.c | 9 +-
.../user/ase/msa/int-multiply/test_msa_mulv_w.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_asub_s_b.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_asub_s_d.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_asub_s_h.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_asub_s_w.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_asub_u_b.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_asub_u_d.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_asub_u_h.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_asub_u_w.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_hsub_s_d.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_hsub_s_h.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_hsub_s_w.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_hsub_u_d.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_hsub_u_h.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_hsub_u_w.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subs_s_b.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subs_s_d.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subs_s_h.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subs_s_w.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subs_u_b.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subs_u_d.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subs_u_h.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subs_u_w.c | 9 +-
.../ase/msa/int-subtract/test_msa_subsus_u_b.c | 9 +-
.../ase/msa/int-subtract/test_msa_subsus_u_d.c | 9 +-
.../ase/msa/int-subtract/test_msa_subsus_u_h.c | 9 +-
.../ase/msa/int-subtract/test_msa_subsus_u_w.c | 9 +-
.../ase/msa/int-subtract/test_msa_subsuu_s_b.c | 9 +-
.../ase/msa/int-subtract/test_msa_subsuu_s_d.c | 9 +-
.../ase/msa/int-subtract/test_msa_subsuu_s_h.c | 9 +-
.../ase/msa/int-subtract/test_msa_subsuu_s_w.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subv_b.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subv_d.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subv_h.c | 9 +-
.../user/ase/msa/int-subtract/test_msa_subv_w.c | 9 +-
.../user/ase/msa/interleave/test_msa_ilvev_b.c | 9 +-
.../user/ase/msa/interleave/test_msa_ilvev_d.c | 9 +-
.../user/ase/msa/interleave/test_msa_ilvev_h.c | 9 +-
.../user/ase/msa/interleave/test_msa_ilvev_w.c | 9 +-
.../mips/user/ase/msa/interleave/test_msa_ilvl_b.c | 9 +-
.../mips/user/ase/msa/interleave/test_msa_ilvl_d.c | 9 +-
.../mips/user/ase/msa/interleave/test_msa_ilvl_h.c | 9 +-
.../mips/user/ase/msa/interleave/test_msa_ilvl_w.c | 9 +-
.../user/ase/msa/interleave/test_msa_ilvod_b.c | 9 +-
.../user/ase/msa/interleave/test_msa_ilvod_d.c | 9 +-
.../user/ase/msa/interleave/test_msa_ilvod_h.c | 9 +-
.../user/ase/msa/interleave/test_msa_ilvod_w.c | 9 +-
.../mips/user/ase/msa/interleave/test_msa_ilvr_b.c | 9 +-
.../mips/user/ase/msa/interleave/test_msa_ilvr_d.c | 9 +-
.../mips/user/ase/msa/interleave/test_msa_ilvr_h.c | 9 +-
.../mips/user/ase/msa/interleave/test_msa_ilvr_w.c | 9 +-
tests/tcg/mips/user/ase/msa/logic/test_msa_and_v.c | 9 +-
tests/tcg/mips/user/ase/msa/logic/test_msa_nor_v.c | 9 +-
tests/tcg/mips/user/ase/msa/logic/test_msa_or_v.c | 9 +-
tests/tcg/mips/user/ase/msa/logic/test_msa_xor_v.c | 9 +-
.../tcg/mips/user/ase/msa/pack/test_msa_pckev_b.c | 67 ++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckev_d.c | 67 ++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckev_h.c | 67 ++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckev_w.c | 67 ++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckod_b.c | 67 ++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckod_d.c | 67 ++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckod_h.c | 67 ++++++-
.../tcg/mips/user/ase/msa/pack/test_msa_pckod_w.c | 67 ++++++-
tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_b.c | 67 ++++++-
tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_d.c | 67 ++++++-
tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_h.c | 67 ++++++-
tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_w.c | 67 ++++++-
tests/tcg/mips/user/ase/msa/shift/test_msa_sll_b.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_sll_d.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_sll_h.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_sll_w.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_sra_b.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_sra_d.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_sra_h.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_sra_w.c | 9 +-
.../tcg/mips/user/ase/msa/shift/test_msa_srar_b.c | 9 +-
.../tcg/mips/user/ase/msa/shift/test_msa_srar_d.c | 9 +-
.../tcg/mips/user/ase/msa/shift/test_msa_srar_h.c | 9 +-
.../tcg/mips/user/ase/msa/shift/test_msa_srar_w.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_srl_b.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_srl_d.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_srl_h.c | 9 +-
tests/tcg/mips/user/ase/msa/shift/test_msa_srl_w.c | 9 +-
.../tcg/mips/user/ase/msa/shift/test_msa_srlr_b.c | 9 +-
.../tcg/mips/user/ase/msa/shift/test_msa_srlr_d.c | 9 +-
.../tcg/mips/user/ase/msa/shift/test_msa_srlr_h.c | 9 +-
.../tcg/mips/user/ase/msa/shift/test_msa_srlr_w.c | 9 +-
.../isa/mips64r6/bit-count/test_mips64r6_clo.c | 4 +-
.../isa/mips64r6/bit-count/test_mips64r6_clz.c | 4 +-
.../isa/mips64r6/bit-count/test_mips64r6_dclo.c | 4 +-
.../isa/mips64r6/bit-count/test_mips64r6_dclz.c | 4 +-
.../isa/mips64r6/bit-swap/test_mips64r6_bitswap.c | 4 +-
.../isa/mips64r6/bit-swap/test_mips64r6_dbitswap.c | 4 +-
.../isa/mips64r6/int-multiply/test_mips64r6_dmuh.c | 4 +-
.../mips64r6/int-multiply/test_mips64r6_dmuhu.c | 4 +-
.../isa/mips64r6/int-multiply/test_mips64r6_dmul.c | 4 +-
.../mips64r6/int-multiply/test_mips64r6_dmulu.c | 4 +-
.../isa/mips64r6/int-multiply/test_mips64r6_muh.c | 4 +-
.../isa/mips64r6/int-multiply/test_mips64r6_muhu.c | 4 +-
.../isa/mips64r6/int-multiply/test_mips64r6_mul.c | 4 +-
.../isa/mips64r6/int-multiply/test_mips64r6_mulu.c | 4 +-
.../user/isa/mips64r6/logic/test_mips64r6_and.c | 4 +-
.../user/isa/mips64r6/logic/test_mips64r6_nor.c | 4 +-
.../user/isa/mips64r6/logic/test_mips64r6_or.c | 4 +-
.../user/isa/mips64r6/logic/test_mips64r6_xor.c | 4 +-
.../user/isa/mips64r6/shift/test_mips64r6_dsllv.c | 4 +-
.../user/isa/mips64r6/shift/test_mips64r6_dsrav.c | 4 +-
.../user/isa/mips64r6/shift/test_mips64r6_dsrlv.c | 4 +-
.../user/isa/mips64r6/shift/test_mips64r6_sllv.c | 4 +-
.../user/isa/mips64r6/shift/test_mips64r6_srav.c | 4 +-
.../user/isa/mips64r6/shift/test_mips64r6_srlv.c | 4 +-
264 files changed, 2848 insertions(+), 748 deletions(-)
create mode 100644 tests/tcg/mips/user/ase/msa/bit-move/test_msa_bmnz_v.c
create mode 100644 tests/tcg/mips/user/ase/msa/bit-move/test_msa_bmz_v.c
create mode 100644 tests/tcg/mips/user/ase/msa/bit-move/test_msa_bsel_v.c
--
2.7.4
^ permalink raw reply
* Re: [PATCH v2 2/3] media: stm32-dcmi: add media controller support
From: Hans Verkuil @ 2019-06-20 12:01 UTC (permalink / raw)
To: Hugues Fruchet, Alexandre Torgue, Mauro Carvalho Chehab,
Sakari Ailus
Cc: Mickael GUENE, linux-kernel, Philippe CORNU, Yannick Fertre,
Benjamin Gaignard, linux-stm32, linux-arm-kernel, linux-media
In-Reply-To: <1560242912-17138-3-git-send-email-hugues.fruchet@st.com>
On 6/11/19 10:48 AM, Hugues Fruchet wrote:
> Add media controller support to dcmi.
>
> Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
> ---
> drivers/media/platform/Kconfig | 2 +-
> drivers/media/platform/stm32/stm32-dcmi.c | 83 +++++++++++++++++++++++--------
> 2 files changed, 63 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
> index 8a19654..de7e21f 100644
> --- a/drivers/media/platform/Kconfig
> +++ b/drivers/media/platform/Kconfig
> @@ -121,7 +121,7 @@ config VIDEO_S3C_CAMIF
>
> config VIDEO_STM32_DCMI
> tristate "STM32 Digital Camera Memory Interface (DCMI) support"
> - depends on VIDEO_V4L2 && OF
> + depends on VIDEO_V4L2 && OF && MEDIA_CONTROLLER
> depends on ARCH_STM32 || COMPILE_TEST
> select VIDEOBUF2_DMA_CONTIG
> select V4L2_FWNODE
> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
> index 7a4d559..3a69783 100644
> --- a/drivers/media/platform/stm32/stm32-dcmi.c
> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
> @@ -170,6 +170,9 @@ struct stm32_dcmi {
>
> /* Ensure DMA operations atomicity */
> struct mutex dma_lock;
> +
> + struct media_device mdev;
> + struct media_pad vid_cap_pad;
> };
>
> static inline struct stm32_dcmi *notifier_to_dcmi(struct v4l2_async_notifier *n)
> @@ -1545,21 +1548,12 @@ static int dcmi_graph_notify_complete(struct v4l2_async_notifier *notifier)
> dev_err(dcmi->dev, "Could not get sensor bounds\n");
> return ret;
> }
> -
> ret = dcmi_set_default_fmt(dcmi);
> if (ret) {
> dev_err(dcmi->dev, "Could not set default format\n");
> return ret;
> }
>
> - ret = video_register_device(dcmi->vdev, VFL_TYPE_GRABBER, -1);
> - if (ret) {
> - dev_err(dcmi->dev, "Failed to register video device\n");
> - return ret;
> - }
Why was this moved to probe()? Off-hand I see no reason for that.
Regards,
Hans
> -
> - dev_dbg(dcmi->dev, "Device registered as %s\n",
> - video_device_node_name(dcmi->vdev));
> return 0;
> }
>
> @@ -1648,6 +1642,12 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)
> return 0;
> }
>
> +static void dcmi_graph_deinit(struct stm32_dcmi *dcmi)
> +{
> + v4l2_async_notifier_unregister(&dcmi->notifier);
> + v4l2_async_notifier_cleanup(&dcmi->notifier);
> +}
> +
> static int dcmi_probe(struct platform_device *pdev)
> {
> struct device_node *np = pdev->dev.of_node;
> @@ -1752,10 +1752,27 @@ static int dcmi_probe(struct platform_device *pdev)
>
> q = &dcmi->queue;
>
> + dcmi->v4l2_dev.mdev = &dcmi->mdev;
> +
> + /* Initialize media device */
> + strscpy(dcmi->mdev.model, DRV_NAME, sizeof(dcmi->mdev.model));
> + snprintf(dcmi->mdev.bus_info, sizeof(dcmi->mdev.bus_info),
> + "platform:%s", DRV_NAME);
> + dcmi->mdev.dev = &pdev->dev;
> + media_device_init(&dcmi->mdev);
> +
> + /* Register the media device */
> + ret = media_device_register(&dcmi->mdev);
> + if (ret) {
> + dev_err(dcmi->dev, "Failed to register media device (%d)\n",
> + ret);
> + goto err_media_device_cleanup;
> + }
> +
> /* Initialize the top-level structure */
> ret = v4l2_device_register(&pdev->dev, &dcmi->v4l2_dev);
> if (ret)
> - goto err_dma_release;
> + goto err_media_device_unregister;
>
> dcmi->vdev = video_device_alloc();
> if (!dcmi->vdev) {
> @@ -1775,6 +1792,25 @@ static int dcmi_probe(struct platform_device *pdev)
> V4L2_CAP_READWRITE;
> video_set_drvdata(dcmi->vdev, dcmi);
>
> + /* Media entity pads */
> + dcmi->vid_cap_pad.flags = MEDIA_PAD_FL_SINK;
> + ret = media_entity_pads_init(&dcmi->vdev->entity,
> + 1, &dcmi->vid_cap_pad);
> + if (ret) {
> + dev_err(dcmi->dev, "Failed to init media entity pad\n");
> + goto err_device_unregister;
> + }
> + dcmi->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT;
> +
> + ret = video_register_device(dcmi->vdev, VFL_TYPE_GRABBER, -1);
> + if (ret) {
> + dev_err(dcmi->dev, "Failed to register video device\n");
> + goto err_media_entity_cleanup;
> + }
> +
> + dev_dbg(dcmi->dev, "Device registered as %s\n",
> + video_device_node_name(dcmi->vdev));
> +
> /* Buffer queue */
> q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
> q->io_modes = VB2_MMAP | VB2_READ | VB2_DMABUF;
> @@ -1790,18 +1826,18 @@ static int dcmi_probe(struct platform_device *pdev)
> ret = vb2_queue_init(q);
> if (ret < 0) {
> dev_err(&pdev->dev, "Failed to initialize vb2 queue\n");
> - goto err_device_release;
> + goto err_media_entity_cleanup;
> }
>
> ret = dcmi_graph_init(dcmi);
> if (ret < 0)
> - goto err_device_release;
> + goto err_media_entity_cleanup;
>
> /* Reset device */
> ret = reset_control_assert(dcmi->rstc);
> if (ret) {
> dev_err(&pdev->dev, "Failed to assert the reset line\n");
> - goto err_cleanup;
> + goto err_graph_deinit;
> }
>
> usleep_range(3000, 5000);
> @@ -1809,7 +1845,7 @@ static int dcmi_probe(struct platform_device *pdev)
> ret = reset_control_deassert(dcmi->rstc);
> if (ret) {
> dev_err(&pdev->dev, "Failed to deassert the reset line\n");
> - goto err_cleanup;
> + goto err_graph_deinit;
> }
>
> dev_info(&pdev->dev, "Probe done\n");
> @@ -1820,13 +1856,16 @@ static int dcmi_probe(struct platform_device *pdev)
>
> return 0;
>
> -err_cleanup:
> - v4l2_async_notifier_cleanup(&dcmi->notifier);
> -err_device_release:
> - video_device_release(dcmi->vdev);
> +err_graph_deinit:
> + dcmi_graph_deinit(dcmi);
> +err_media_entity_cleanup:
> + media_entity_cleanup(&dcmi->vdev->entity);
> err_device_unregister:
> v4l2_device_unregister(&dcmi->v4l2_dev);
> -err_dma_release:
> +err_media_device_unregister:
> + media_device_unregister(&dcmi->mdev);
> +err_media_device_cleanup:
> + media_device_cleanup(&dcmi->mdev);
> dma_release_channel(dcmi->dma_chan);
>
> return ret;
> @@ -1838,9 +1877,11 @@ static int dcmi_remove(struct platform_device *pdev)
>
> pm_runtime_disable(&pdev->dev);
>
> - v4l2_async_notifier_unregister(&dcmi->notifier);
> - v4l2_async_notifier_cleanup(&dcmi->notifier);
> + dcmi_graph_deinit(dcmi);
> + media_entity_cleanup(&dcmi->vdev->entity);
> v4l2_device_unregister(&dcmi->v4l2_dev);
> + media_device_unregister(&dcmi->mdev);
> + media_device_cleanup(&dcmi->mdev);
>
> dma_release_channel(dcmi->dma_chan);
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 04/14] ABI: better identificate tables
From: Johan Hovold @ 2019-06-20 12:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Mauro Carvalho Chehab, Johan Hovold, Linux Doc Mailing List,
Mauro Carvalho Chehab, Mauro Carvalho Chehab, linux-kernel,
Jonathan Corbet, Stefan Achatz
In-Reply-To: <20190619150207.GA19346@kroah.com>
On Wed, Jun 19, 2019 at 05:02:07PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Jun 19, 2019 at 10:56:33AM -0300, Mauro Carvalho Chehab wrote:
> > Hi Johan,
> >
> > Em Wed, 19 Jun 2019 14:51:35 +0200
> > Johan Hovold <johan@kernel.org> escreveu:
> >
> > > On Thu, Jun 13, 2019 at 11:04:10PM -0300, Mauro Carvalho Chehab wrote:
> > > > From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> > > >
> > > > When parsing via script, it is important to know if the script
> > > > should consider a description as a literal block that should
> > > > be displayed as-is, or if the description can be considered
> > > > as a normal text.
> > > >
> > > > Change descriptions to ensure that the preceding line of a table
> > > > ends with a colon. That makes easy to identify the need of a
> > > > literal block.
> > >
> > > In the cover letter you say that the first four patches of this series,
> > > including this one, "fix some ABI descriptions that are violating the
> > > syntax described at Documentation/ABI/README". This seems a bit harsh,
> > > given that it's you that is now *introducing* a new syntax requirement
> > > to assist your script.
> >
> > Yeah, what's there at the cover letter doesn't apply to this specific
> > patch. The thing is that I wrote this series a lot of time ago (2016/17).
Got it, thanks.
[...]
> > In the specific case of this patch, the ":" there actually makes sense
> > for someone that it is reading it as a text file, and it is an easy
> > hack to make it parse better.
Human readers probably depend on more on tabulation and white space.
When the preceding description wasn't using a colon to begin with (and
you just replace s/\./:/) it can even look weird, but no big deal.
> > > Specifically, this new requirement isn't documented anywhere AFAICT, so
> > > how will anyone adding new ABI descriptions learn about it?
> >
> > Yeah, either that or provide an alternative to "Description" tag, to be
> > used with more complex ABI descriptions.
> >
> > One of the things that occurred to me, back on 2017, is that we should
> > have a way to to specify that an specific ABI description would have
> > a rich format. Something like:
[...]
> I don't know when "Description" and "RST-Description" would be used.
> Why not just parse "Description" like rst text and if things are "messy"
> we fix them up as found, like you did with the ":" here? It doesn't
> have to be complex, we can always fix them up after-the-fact if new
> stuff gets added that doesn't quite parse properly.
>
> Just like we do for most kernel-doc formatting :)
But kernel-doc has a documented format, which was sort of the point I
was trying to make. If the new get_abi.pl scripts expects a colon I
think it should be mentioned somewhere (e.g. Documentation/ABI/README).
Grepping for attribute entries in linux-next still reveals a number
descriptions that still lack that colon and use varying formatting. More
are bound to be added later, but perhaps that's ok depending on what
you're aiming at here.
Johan
^ permalink raw reply
* Re: [PATCH v2 2/3] media: stm32-dcmi: add media controller support
From: Hans Verkuil @ 2019-06-20 12:01 UTC (permalink / raw)
To: Hugues Fruchet, Alexandre Torgue, Mauro Carvalho Chehab,
Sakari Ailus
Cc: linux-media, linux-arm-kernel, linux-kernel, linux-stm32,
Benjamin Gaignard, Yannick Fertre, Philippe CORNU, Mickael GUENE
In-Reply-To: <1560242912-17138-3-git-send-email-hugues.fruchet@st.com>
On 6/11/19 10:48 AM, Hugues Fruchet wrote:
> Add media controller support to dcmi.
>
> Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
> ---
> drivers/media/platform/Kconfig | 2 +-
> drivers/media/platform/stm32/stm32-dcmi.c | 83 +++++++++++++++++++++++--------
> 2 files changed, 63 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
> index 8a19654..de7e21f 100644
> --- a/drivers/media/platform/Kconfig
> +++ b/drivers/media/platform/Kconfig
> @@ -121,7 +121,7 @@ config VIDEO_S3C_CAMIF
>
> config VIDEO_STM32_DCMI
> tristate "STM32 Digital Camera Memory Interface (DCMI) support"
> - depends on VIDEO_V4L2 && OF
> + depends on VIDEO_V4L2 && OF && MEDIA_CONTROLLER
> depends on ARCH_STM32 || COMPILE_TEST
> select VIDEOBUF2_DMA_CONTIG
> select V4L2_FWNODE
> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
> index 7a4d559..3a69783 100644
> --- a/drivers/media/platform/stm32/stm32-dcmi.c
> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
> @@ -170,6 +170,9 @@ struct stm32_dcmi {
>
> /* Ensure DMA operations atomicity */
> struct mutex dma_lock;
> +
> + struct media_device mdev;
> + struct media_pad vid_cap_pad;
> };
>
> static inline struct stm32_dcmi *notifier_to_dcmi(struct v4l2_async_notifier *n)
> @@ -1545,21 +1548,12 @@ static int dcmi_graph_notify_complete(struct v4l2_async_notifier *notifier)
> dev_err(dcmi->dev, "Could not get sensor bounds\n");
> return ret;
> }
> -
> ret = dcmi_set_default_fmt(dcmi);
> if (ret) {
> dev_err(dcmi->dev, "Could not set default format\n");
> return ret;
> }
>
> - ret = video_register_device(dcmi->vdev, VFL_TYPE_GRABBER, -1);
> - if (ret) {
> - dev_err(dcmi->dev, "Failed to register video device\n");
> - return ret;
> - }
Why was this moved to probe()? Off-hand I see no reason for that.
Regards,
Hans
> -
> - dev_dbg(dcmi->dev, "Device registered as %s\n",
> - video_device_node_name(dcmi->vdev));
> return 0;
> }
>
> @@ -1648,6 +1642,12 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)
> return 0;
> }
>
> +static void dcmi_graph_deinit(struct stm32_dcmi *dcmi)
> +{
> + v4l2_async_notifier_unregister(&dcmi->notifier);
> + v4l2_async_notifier_cleanup(&dcmi->notifier);
> +}
> +
> static int dcmi_probe(struct platform_device *pdev)
> {
> struct device_node *np = pdev->dev.of_node;
> @@ -1752,10 +1752,27 @@ static int dcmi_probe(struct platform_device *pdev)
>
> q = &dcmi->queue;
>
> + dcmi->v4l2_dev.mdev = &dcmi->mdev;
> +
> + /* Initialize media device */
> + strscpy(dcmi->mdev.model, DRV_NAME, sizeof(dcmi->mdev.model));
> + snprintf(dcmi->mdev.bus_info, sizeof(dcmi->mdev.bus_info),
> + "platform:%s", DRV_NAME);
> + dcmi->mdev.dev = &pdev->dev;
> + media_device_init(&dcmi->mdev);
> +
> + /* Register the media device */
> + ret = media_device_register(&dcmi->mdev);
> + if (ret) {
> + dev_err(dcmi->dev, "Failed to register media device (%d)\n",
> + ret);
> + goto err_media_device_cleanup;
> + }
> +
> /* Initialize the top-level structure */
> ret = v4l2_device_register(&pdev->dev, &dcmi->v4l2_dev);
> if (ret)
> - goto err_dma_release;
> + goto err_media_device_unregister;
>
> dcmi->vdev = video_device_alloc();
> if (!dcmi->vdev) {
> @@ -1775,6 +1792,25 @@ static int dcmi_probe(struct platform_device *pdev)
> V4L2_CAP_READWRITE;
> video_set_drvdata(dcmi->vdev, dcmi);
>
> + /* Media entity pads */
> + dcmi->vid_cap_pad.flags = MEDIA_PAD_FL_SINK;
> + ret = media_entity_pads_init(&dcmi->vdev->entity,
> + 1, &dcmi->vid_cap_pad);
> + if (ret) {
> + dev_err(dcmi->dev, "Failed to init media entity pad\n");
> + goto err_device_unregister;
> + }
> + dcmi->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT;
> +
> + ret = video_register_device(dcmi->vdev, VFL_TYPE_GRABBER, -1);
> + if (ret) {
> + dev_err(dcmi->dev, "Failed to register video device\n");
> + goto err_media_entity_cleanup;
> + }
> +
> + dev_dbg(dcmi->dev, "Device registered as %s\n",
> + video_device_node_name(dcmi->vdev));
> +
> /* Buffer queue */
> q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
> q->io_modes = VB2_MMAP | VB2_READ | VB2_DMABUF;
> @@ -1790,18 +1826,18 @@ static int dcmi_probe(struct platform_device *pdev)
> ret = vb2_queue_init(q);
> if (ret < 0) {
> dev_err(&pdev->dev, "Failed to initialize vb2 queue\n");
> - goto err_device_release;
> + goto err_media_entity_cleanup;
> }
>
> ret = dcmi_graph_init(dcmi);
> if (ret < 0)
> - goto err_device_release;
> + goto err_media_entity_cleanup;
>
> /* Reset device */
> ret = reset_control_assert(dcmi->rstc);
> if (ret) {
> dev_err(&pdev->dev, "Failed to assert the reset line\n");
> - goto err_cleanup;
> + goto err_graph_deinit;
> }
>
> usleep_range(3000, 5000);
> @@ -1809,7 +1845,7 @@ static int dcmi_probe(struct platform_device *pdev)
> ret = reset_control_deassert(dcmi->rstc);
> if (ret) {
> dev_err(&pdev->dev, "Failed to deassert the reset line\n");
> - goto err_cleanup;
> + goto err_graph_deinit;
> }
>
> dev_info(&pdev->dev, "Probe done\n");
> @@ -1820,13 +1856,16 @@ static int dcmi_probe(struct platform_device *pdev)
>
> return 0;
>
> -err_cleanup:
> - v4l2_async_notifier_cleanup(&dcmi->notifier);
> -err_device_release:
> - video_device_release(dcmi->vdev);
> +err_graph_deinit:
> + dcmi_graph_deinit(dcmi);
> +err_media_entity_cleanup:
> + media_entity_cleanup(&dcmi->vdev->entity);
> err_device_unregister:
> v4l2_device_unregister(&dcmi->v4l2_dev);
> -err_dma_release:
> +err_media_device_unregister:
> + media_device_unregister(&dcmi->mdev);
> +err_media_device_cleanup:
> + media_device_cleanup(&dcmi->mdev);
> dma_release_channel(dcmi->dma_chan);
>
> return ret;
> @@ -1838,9 +1877,11 @@ static int dcmi_remove(struct platform_device *pdev)
>
> pm_runtime_disable(&pdev->dev);
>
> - v4l2_async_notifier_unregister(&dcmi->notifier);
> - v4l2_async_notifier_cleanup(&dcmi->notifier);
> + dcmi_graph_deinit(dcmi);
> + media_entity_cleanup(&dcmi->vdev->entity);
> v4l2_device_unregister(&dcmi->v4l2_dev);
> + media_device_unregister(&dcmi->mdev);
> + media_device_cleanup(&dcmi->mdev);
>
> dma_release_channel(dcmi->dma_chan);
>
>
^ permalink raw reply
* [LTP] [PATCH v3] sysctl/sysctl02: Add new regression test for overflow file-max
From: Petr Vorel @ 2019-06-20 12:01 UTC (permalink / raw)
To: ltp
In-Reply-To: <1560156706-13617-1-git-send-email-xuyang2018.jy@cn.fujitsu.com>
Hi,
LGTM, below are just small formatting issues.
I'm going to merge it with these changes below.
> On upstream kernel, before commit[1], the max value in proc_get_long based on
> the number of chars(21). It rejects values such as 184467440737095516160 (21 chars)
> but accepts values such as 18446744073709551616 (20 chars). But we should reject all
> because both are overflows. After this commit,the permitted max value is 2^64-1.
> Before commit[2], when writing echo 18446744073709551616 > /proc/sys/fs/file-max
> /proc/sys/fs/file-max will overflow and be set to 0. It may crash the system. This
> commit sets the max and min value for file-max. After this commit,the permitted max
> value is 2^63-1.
> Unfortunately, commit[2] introduced the minimum value points at the global 'zero'
> variable which is an int. This results in a KASAN splat when accessed as a long by
> proc_doulongvec_minmax on 64-bit architectures. This bug has been fixed by commit[3].
> I will set 2^64 ,2^64-1,2^63 and 0 to file-max in case and test it.
> [1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7f2923c4f73f21cfd714d12a2d48de8c21f11cfe
> [2]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=32a5ad9c22852e6bd9e74bdec5934ef9d1480bc5
> [3]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9002b21465fa4d829edfc94a5a441005cffaa972
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> ---
> runtest/commands | 1 +
> testcases/commands/sysctl/sysctl02.sh | 96 +++++++++++++++++++++++++++
> 2 files changed, 97 insertions(+)
> create mode 100755 testcases/commands/sysctl/sysctl02.sh
> diff --git a/runtest/commands b/runtest/commands
> index ac15e8b23..1870c4209 100644
> --- a/runtest/commands
> +++ b/runtest/commands
> @@ -40,3 +40,4 @@ keyctl01_sh keyctl01.sh
> gdb01_sh gdb01.sh
> unshare01_sh unshare01.sh
> sysctl01_sh sysctl01.sh
> +sysctl02_sh sysctl02.sh
> diff --git a/testcases/commands/sysctl/sysctl02.sh b/testcases/commands/sysctl/sysctl02.sh
> new file mode 100755
> index 000000000..22dd0a429
> --- /dev/null
> +++ b/testcases/commands/sysctl/sysctl02.sh
> @@ -0,0 +1,96 @@
> +#!/bin/sh
> +
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
> +# Author: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
> +#
> +# Description:
> +# This is a regression test for handling overflow for file-max.
Instead these 2 lines I'd put just this (nit):
# Regression test for handling overflow for file-max.
> +#
> +# when writing 2^64 to /proc/sys/fs/file-max. It will overflow
> +# and be set to 0. It crash system quickly.
> +#
> +# The kernel bug has been fixed in kernel:
> +# '7f2923c4f' (sysctl: handle overflow in proc_get_long)
> +# the permitted max value is 2^64-1.
> +# '32a5ad9c2' (sysctl: handle overflow for file-max)
> +# the permitted max value is 2^63-1
> +#
> +# After merged this patchset, if we exceed the max value, it will
> +# keep old value. Unfortunately, it introudced a new bug when set it
> +# to 0 and it will lead to system crash.
> +# This bug has been fixed by commit 9002b2146
> +# (kernel/sysctl.c: fix out-of-bounds access when setting file-max)
> +
> +TST_TESTFUNC=do_test
> +TST_SETUP=setup
> +TST_CLEANUP=cleanup
> +TST_CNT=4
> +TST_NEEDS_ROOT=1
> +TST_NEEDS_CMDS="sysctl"
> +dir="/proc/sys/fs/"
> +syms_file="/proc/kallsyms"
> +name="file-max"
> +orig_value=200000
> +
> +. tst_test.sh
> +
> +setup()
> +{
> + [ ! -f "$dir""$name" ] && tst_brk TCONF \
> + "$name was not supported"
[ ! -f "$dir$name" ] && tst_brk TCONF "$name was not supported"
> + orig_value=$(cat "$dir""$name")
> +}
> +
> +do_test()
> +{
> + case $1 in
> + 1)sysctl_test_overflow 18446744073709551616;;
> + 2)sysctl_test_overflow 18446744073709551615;;
> + 3)sysctl_test_overflow 9223372036854775808;;
> + 4)sysctl_test_zero;;
> + esac
> +}
> +
> +sysctl_test_overflow()
> +{
> + local old_value=$(cat "$dir""$name")
> +
> + sysctl -w "fs.file-max"=$1 >/dev/null 2>&1
> +
> + local test_value=$(cat "$dir""$name")
again, why 2 stings instead of one?
local test_value=$(cat "$dir$name")
> +
> + echo ${test_value} |grep -q ${old_value}
> + if [ $? -eq 0 ]; then
> + tst_res TPASS "file-max overflow, reject it and keep old value."
Please don't use dot
> + else
> + tst_res TFAIL "file-max overflow and set it to ${test_value}."
Here as well.
> + fi
> + cleanup
> +}
> +
> +sysctl_test_zero()
> +{
> + sysctl -w "fs.file-max"=0 >/dev/null 2>&1
Please use -q option instead of redirecting.
> + [ ! -f "$syms_file" ] && tst_brk TCONF \
> + "$syms_file was not supported"
> + cat $syms_file |grep kasan_report >/dev/null 2>&1
> + if [ $? -eq 0 ]; then
Also grep has -q, no need to use pipe:
if grep -q kasan_report $syms_file; then
> + dmesg | grep "KASAN: global-out-of-bounds in __do_proc_doulongvec_minmax" >/dev/null
-q here as well.
> + if [ $? -eq 0 ]; then
> + tst_res TFAIL "file-max is set 0 and trigger a KASAN error"
> + else
> + tst_res TPASS \
> + "file-max is set 0 and doesn't trigger a KASAN error"
Probably can be on single line.
> + fi
> + else
> + tst_res TCONF "kernel doesn't support KASAN"
> + fi
> +}
> +
> +cleanup()
> +{
> + sysctl -w "fs.""$name"=${orig_value} >/dev/null 2>&1
It's safe not quote string ($name is safe, but you can of course)
sysctl -q -w fs.$name=$orig_value
> +}
> +
> +tst_run
^ permalink raw reply
* Re: (Small) bias in generation of random passkeys for pairing
From: Stefan Seyfried @ 2019-06-20 12:00 UTC (permalink / raw)
To: Pavel Machek, kernel list, security, linux-bluetooth,
johan.hedberg, marcel
In-Reply-To: <20190619162456.GA9096@amd>
Hi Pavel,
Am 19.06.19 um 18:24 schrieb Pavel Machek:
> Hi!
>
> There's a (small) bias in passkey generation in bluetooth:
>
> get_random_bytes(&passkey, sizeof(passkey));
> passkey %= 1000000;
> put_unaligned_le32(passkey, smp->tk);
>
> (there are at least two places doing this).
>
> All passkeys are not of same probability, passkey "000000" is more
> probable than "999999", but difference is small.
It is slightly different IMHO.
Unsigned 32bits passkey assumed (and all users I found were u32),
the passkeys "000000" to "967295" are slightly more probable than
"967296" to "999999".
If my math is right (which I doubt), the difference in probability
for both entities is 4294:4293.
> Do we care?
I, personally, don't (yet).
But then, I'm not a real security expert.
Have fun,
--
Stefan Seyfried
"For a successful technology, reality must take precedence over
public relations, for nature cannot be fooled." -- Richard Feynman
^ permalink raw reply
* Re: [PATCH 1/2] drm/amdgpu: fix transform feedback GDS hang on gfx10
From: Chunming Zhou @ 2019-06-20 12:00 UTC (permalink / raw)
To: Marek Olšák,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
In-Reply-To: <20190620000216.14272-1-maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
please take care of .emit_ib_size member, otherwise it looks ok to me.
-David
在 2019/6/20 8:02, Marek Olšák 写道:
> From: Marek Olšák <marek.olsak@amd.com>
>
> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h | 3 ++-
> drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 12 ++++++++++--
> 2 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h
> index dad2186f4ed5..df8a23554831 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h
> @@ -24,21 +24,22 @@
> #ifndef __AMDGPU_GDS_H__
> #define __AMDGPU_GDS_H__
>
> struct amdgpu_ring;
> struct amdgpu_bo;
>
> struct amdgpu_gds {
> uint32_t gds_size;
> uint32_t gws_size;
> uint32_t oa_size;
> - uint32_t gds_compute_max_wave_id;
> + uint32_t gds_compute_max_wave_id;
> + uint32_t vgt_gs_max_wave_id;
> };
>
> struct amdgpu_gds_reg_offset {
> uint32_t mem_base;
> uint32_t mem_size;
> uint32_t gws;
> uint32_t oa;
> };
>
> #endif /* __AMDGPU_GDS_H__ */
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> index 0090cba2d24d..75a34779a57c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> @@ -4213,20 +4213,29 @@ static void gfx_v10_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)
> }
>
> static void gfx_v10_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
> struct amdgpu_job *job,
> struct amdgpu_ib *ib,
> uint32_t flags)
> {
> unsigned vmid = AMDGPU_JOB_GET_VMID(job);
> u32 header, control = 0;
>
> + /* Prevent a hw deadlock due to a wave ID mismatch between ME and GDS.
> + * This resets the wave ID counters. (needed by transform feedback)
> + * TODO: This might only be needed on a VMID switch when we change
> + * the GDS OA mapping, not sure.
> + */
> + amdgpu_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1));
> + amdgpu_ring_write(ring, mmVGT_GS_MAX_WAVE_ID);
> + amdgpu_ring_write(ring, ring->adev->gds.vgt_gs_max_wave_id);
> +
> if (ib->flags & AMDGPU_IB_FLAG_CE)
> header = PACKET3(PACKET3_INDIRECT_BUFFER_CNST, 2);
> else
> header = PACKET3(PACKET3_INDIRECT_BUFFER, 2);
>
> control |= ib->length_dw | (vmid << 24);
>
> if (amdgpu_mcbp && (ib->flags & AMDGPU_IB_FLAG_PREEMPT)) {
> control |= INDIRECT_BUFFER_PRE_ENB(1);
>
> @@ -5094,24 +5103,23 @@ static void gfx_v10_0_set_rlc_funcs(struct amdgpu_device *adev)
> default:
> break;
> }
> }
>
> static void gfx_v10_0_set_gds_init(struct amdgpu_device *adev)
> {
> /* init asic gds info */
> switch (adev->asic_type) {
> case CHIP_NAVI10:
> - adev->gds.gds_size = 0x10000;
> - break;
> default:
> adev->gds.gds_size = 0x10000;
> + adev->gds.vgt_gs_max_wave_id = 0x3ff;
> break;
> }
>
> adev->gds.gws_size = 64;
> adev->gds.oa_size = 16;
> }
>
> static void gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device *adev,
> u32 bitmap)
> {
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply
* Re: [Qemu-devel] [PATCH] Makefile: Rename the 'vm-test' target as 'vm-help'
From: Philippe Mathieu-Daudé @ 2019-06-20 11:03 UTC (permalink / raw)
To: Stefano Garzarella; +Cc: Fam Zheng, Alex Bennée, qemu-devel
In-Reply-To: <20190531073859.ojouyr3urzcarn4f@steredhat.homenet.telecomitalia.it>
Hi Stefano,
On 5/31/19 9:38 AM, Stefano Garzarella wrote:
> On Fri, May 31, 2019 at 08:43:41AM +0200, Philippe Mathieu-Daudé wrote:
>> We already have 'make check-help', use the 'make vm-help' form
>> to display helps about VM testing. Keep the old target to not
>> bother old customs.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> Based-on: <20190530101603.22254-1-alex.bennee@linaro.org>
>> "testing/next queue"
>> ---
>> Makefile | 4 ++--
>> docs/devel/testing.rst | 4 ++--
>> tests/vm/Makefile.include | 5 +++--
>> 3 files changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index f0be624f47..f67739df7c 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -9,7 +9,7 @@ SRC_PATH=.
>> UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
>> html info pdf txt \
>> help check-help print-% \
>> - docker docker-% vm-test vm-build-%
>> + docker docker-% vm-help vm-test vm-build-%
>>
>> print-%:
>> @echo '$*=$($*)'
>> @@ -1121,7 +1121,7 @@ endif
>> @echo 'Test targets:'
>> @echo ' check - Run all tests (check-help for details)'
>> @echo ' docker - Help about targets running tests inside Docker containers'
>> - @echo ' vm-test - Help about targets running tests inside VM'
>> + @echo ' vm-help - Help about targets running tests inside VM'
>> @echo ''
>> @echo 'Documentation targets:'
>> @echo ' html info pdf txt'
>> diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
>> index da2d0fc964..68aba3926e 100644
>> --- a/docs/devel/testing.rst
>> +++ b/docs/devel/testing.rst
>> @@ -399,12 +399,12 @@ VM testing
>>
>> This test suite contains scripts that bootstrap various guest images that have
>> necessary packages to build QEMU. The basic usage is documented in ``Makefile``
>> -help which is displayed with ``make vm-test``.
>> +help which is displayed with ``make vm-help``.
>>
>> Quickstart
>> ----------
>>
>> -Run ``make vm-test`` to list available make targets. Invoke a specific make
>> +Run ``make vm-help`` to list available make targets. Invoke a specific make
>> command to run build test in an image. For example, ``make vm-build-freebsd``
>> will build the source tree in the FreeBSD image. The command can be executed
>> from either the source tree or the build dir; if the former, ``./configure`` is
>> diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
>> index 5e37063d32..b7311d7bd9 100644
>> --- a/tests/vm/Makefile.include
>> +++ b/tests/vm/Makefile.include
>> @@ -8,8 +8,9 @@ IMAGE_FILES := $(patsubst %, $(IMAGES_DIR)/%.img, $(IMAGES))
>>
>> .PRECIOUS: $(IMAGE_FILES)
>>
>> -vm-test:
>> - @echo "vm-test: Test QEMU in preconfigured virtual machines"
>
> What about adding something like this?
> vm-test: vm-help
> @echo ""
> @echo "vm-test is deprecated, please use vm-help"
I wouldn't worry about deprecation warnings for dev tools, it would be
just noise :)
>
>> +# 'vm-help' target was historically named 'vm-test'
>> +vm-help vm-test:
>> + @echo "vm-help: Test QEMU in preconfigured virtual machines"
>> @echo
>> @echo " vm-build-ubuntu.i386 - Build QEMU in ubuntu i386 VM"
>> @echo " vm-build-freebsd - Build QEMU in FreeBSD VM"
>> --
>> 2.20.1
>>
>
> With or without the vm-test message:
>
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Thanks!
Phil.
^ permalink raw reply
* [PATCH 3/3] fetch-pack: print server version at the top in -v -v
From: Nguyễn Thái Ngọc Duy @ 2019-06-20 11:59 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <20190620115951.13629-1-pclouds@gmail.com>
Before the previous patch, the server version is printed after all the
"Server supports" lines. The previous one puts the version in the middle
of "Server supports" group.
Instead of moving it to the bottom, I move it to the top. Version may
stand out more at the top as we will have even more debug out after
capabilities.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
fetch-pack.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/fetch-pack.c b/fetch-pack.c
index de935f8776..445a261f14 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -902,6 +902,13 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
sort_ref_list(&ref, ref_compare_name);
QSORT(sought, nr_sought, cmp_ref_by_name);
+ if ((agent_feature = server_feature_value("agent", &agent_len))) {
+ agent_supported = 1;
+ if (agent_len)
+ print_verbose(args, _("Server version is %.*s"),
+ agent_len, agent_feature);
+ }
+
if (server_supports("shallow"))
print_verbose(args, _("Server supports %s"), "shallow");
else if (args->depth > 0 || is_repository_shallow(the_repository))
@@ -961,12 +968,6 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
warning("filtering not recognized by server, ignoring");
}
- if ((agent_feature = server_feature_value("agent", &agent_len))) {
- agent_supported = 1;
- if (agent_len)
- print_verbose(args, _("Server version is %.*s"),
- agent_len, agent_feature);
- }
if (server_supports("deepen-since")) {
print_verbose(args, _("Server supports %s"), "deepen-since");
deepen_since_ok = 1;
--
2.22.0.rc0.322.g2b0371e29a
^ permalink raw reply related
* [PATCH 2/3] fetch-pack: print all relevant supported capabilities with -v -v
From: Nguyễn Thái Ngọc Duy @ 2019-06-20 11:59 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <20190620115951.13629-1-pclouds@gmail.com>
When we check if some capability is supported, we do print something in
verbose mode. Some capabilities are not printed though (and it made me
think it's not supported; I was more used to GIT_TRACE_PACKET) so let's
print them all.
It's a bit more code. And one could argue for printing all supported
capabilities the server sends us. But I think it's still valuable this
way because we see the capabilities that the client cares about.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
fetch-pack.c | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/fetch-pack.c b/fetch-pack.c
index 0532029f2c..de935f8776 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -902,7 +902,9 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
sort_ref_list(&ref, ref_compare_name);
QSORT(sought, nr_sought, cmp_ref_by_name);
- if ((args->depth > 0 || is_repository_shallow(the_repository)) && !server_supports("shallow"))
+ if (server_supports("shallow"))
+ print_verbose(args, _("Server supports %s"), "shallow");
+ else if (args->depth > 0 || is_repository_shallow(the_repository))
die(_("Server does not support shallow clients"));
if (args->depth > 0 || args->deepen_since || args->deepen_not)
args->deepen = 1;
@@ -935,11 +937,17 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
print_verbose(args, _("Server supports %s"), "allow-reachable-sha1-in-want");
allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
}
- if (!server_supports("thin-pack"))
+ if (server_supports("thin-pack"))
+ print_verbose(args, _("Server supports %s"), "thin-pack");
+ else
args->use_thin_pack = 0;
- if (!server_supports("no-progress"))
+ if (server_supports("no-progress"))
+ print_verbose(args, _("Server supports %s"), "no-progress");
+ else
args->no_progress = 0;
- if (!server_supports("include-tag"))
+ if (server_supports("include-tag"))
+ print_verbose(args, _("Server supports %s"), "include-tag");
+ else
args->include_tag = 0;
if (server_supports("ofs-delta"))
print_verbose(args, _("Server supports %s"), "ofs-delta");
@@ -959,15 +967,19 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
print_verbose(args, _("Server version is %.*s"),
agent_len, agent_feature);
}
- if (server_supports("deepen-since"))
+ if (server_supports("deepen-since")) {
+ print_verbose(args, _("Server supports %s"), "deepen-since");
deepen_since_ok = 1;
- else if (args->deepen_since)
+ } else if (args->deepen_since)
die(_("Server does not support --shallow-since"));
- if (server_supports("deepen-not"))
+ if (server_supports("deepen-not")) {
+ print_verbose(args, _("Server supports %s"), "deepen-not");
deepen_not_ok = 1;
- else if (args->deepen_not)
+ } else if (args->deepen_not)
die(_("Server does not support --shallow-exclude"));
- if (!server_supports("deepen-relative") && args->deepen_relative)
+ if (server_supports("deepen-relative"))
+ print_verbose(args, _("Server supports %s"), "deepen-relative");
+ else if (args->deepen_relative)
die(_("Server does not support --deepen"));
if (!args->no_dependents) {
--
2.22.0.rc0.322.g2b0371e29a
^ permalink raw reply related
* [PATCH 1/3] fetch-pack: move capability names out of i18n strings
From: Nguyễn Thái Ngọc Duy @ 2019-06-20 11:59 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
This reduces the work on translators since they only have one string to
translate (and I think it's still enough context to translate). It also
makes sure no capability name is translated by accident.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
fetch-pack.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fetch-pack.c b/fetch-pack.c
index 1c10f54e78..0532029f2c 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -907,32 +907,32 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
if (args->depth > 0 || args->deepen_since || args->deepen_not)
args->deepen = 1;
if (server_supports("multi_ack_detailed")) {
- print_verbose(args, _("Server supports multi_ack_detailed"));
+ print_verbose(args, _("Server supports %s"), "multi_ack_detailed");
multi_ack = 2;
if (server_supports("no-done")) {
- print_verbose(args, _("Server supports no-done"));
+ print_verbose(args, _("Server supports %s"), "no-done");
if (args->stateless_rpc)
no_done = 1;
}
}
else if (server_supports("multi_ack")) {
- print_verbose(args, _("Server supports multi_ack"));
+ print_verbose(args, _("Server supports %s"), "multi_ack");
multi_ack = 1;
}
if (server_supports("side-band-64k")) {
- print_verbose(args, _("Server supports side-band-64k"));
+ print_verbose(args, _("Server supports %s"), "side-band-64k");
use_sideband = 2;
}
else if (server_supports("side-band")) {
- print_verbose(args, _("Server supports side-band"));
+ print_verbose(args, _("Server supports %s"), "side-band");
use_sideband = 1;
}
if (server_supports("allow-tip-sha1-in-want")) {
- print_verbose(args, _("Server supports allow-tip-sha1-in-want"));
+ print_verbose(args, _("Server supports %s"), "allow-tip-sha1-in-want");
allow_unadvertised_object_request |= ALLOW_TIP_SHA1;
}
if (server_supports("allow-reachable-sha1-in-want")) {
- print_verbose(args, _("Server supports allow-reachable-sha1-in-want"));
+ print_verbose(args, _("Server supports %s"), "allow-reachable-sha1-in-want");
allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
}
if (!server_supports("thin-pack"))
@@ -942,13 +942,13 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
if (!server_supports("include-tag"))
args->include_tag = 0;
if (server_supports("ofs-delta"))
- print_verbose(args, _("Server supports ofs-delta"));
+ print_verbose(args, _("Server supports %s"), "ofs-delta");
else
prefer_ofs_delta = 0;
if (server_supports("filter")) {
server_supports_filtering = 1;
- print_verbose(args, _("Server supports filter"));
+ print_verbose(args, _("Server supports %s"), "filter");
} else if (args->filter_options.choice) {
warning("filtering not recognized by server, ignoring");
}
--
2.22.0.rc0.322.g2b0371e29a
^ permalink raw reply related
* [Qemu-devel] [PATCH v5 2/2] ati-vga: Implement DDC and EDID info from monitor
From: BALATON Zoltan @ 2019-06-20 10:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Corey Minyard, Gerd Hoffmann
In-Reply-To: <cover.1561028123.git.balaton@eik.bme.hu>
This adds DDC support to ati-vga and connects i2c-ddc to it. This
allows at least MacOS with an ATI ndrv, Linux radeonfb and MorphOS to
get monitor EDID info (although MorphOS splash screen is not displayed
and radeonfb needs additional tables from vgabios-rv100). Xorg needs
additional support from VESA vgabios, it's missing INT10 0x4F15
function (see
https://gitlab.freedesktop.org/xorg/xserver/blob/master/hw/xfree86/vbe/vbe.c)
without which no DDC is available that also prevents loading the
accelerated X driver.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/display/Kconfig | 2 ++
hw/display/ati.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++--
hw/display/ati_int.h | 5 +++++
hw/display/ati_regs.h | 2 ++
4 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/hw/display/Kconfig b/hw/display/Kconfig
index 910dccb2f7..cbdf7b1a67 100644
--- a/hw/display/Kconfig
+++ b/hw/display/Kconfig
@@ -130,3 +130,5 @@ config ATI_VGA
default y if PCI_DEVICES
depends on PCI
select VGA
+ select BITBANG_I2C
+ select DDC
diff --git a/hw/display/ati.c b/hw/display/ati.c
index 76595d9511..61e351a024 100644
--- a/hw/display/ati.c
+++ b/hw/display/ati.c
@@ -26,6 +26,7 @@
#include "qapi/error.h"
#include "hw/hw.h"
#include "ui/console.h"
+#include "hw/display/i2c-ddc.h"
#include "trace.h"
#define ATI_DEBUG_HW_CURSOR 0
@@ -215,6 +216,24 @@ static void ati_cursor_draw_line(VGACommonState *vga, uint8_t *d, int scr_y)
}
}
+static uint64_t ati_i2c(bitbang_i2c_interface *i2c, uint64_t data, int base)
+{
+ bool c = (data & BIT(base + 17) ? !!(data & BIT(base + 1)) : 1);
+ bool d = (data & BIT(base + 16) ? !!(data & BIT(base)) : 1);
+
+ bitbang_i2c_set(i2c, BITBANG_I2C_SCL, c);
+ d = bitbang_i2c_set(i2c, BITBANG_I2C_SDA, d);
+
+ data &= ~0xf00ULL;
+ if (c) {
+ data |= BIT(base + 9);
+ }
+ if (d) {
+ data |= BIT(base + 8);
+ }
+ return data;
+}
+
static inline uint64_t ati_reg_read_offs(uint32_t reg, int offs,
unsigned int size)
{
@@ -266,7 +285,16 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size)
case DAC_CNTL:
val = s->regs.dac_cntl;
break;
-/* case GPIO_MONID: FIXME hook up DDC I2C here */
+ case GPIO_VGA_DDC:
+ val = s->regs.gpio_vga_ddc;
+ break;
+ case GPIO_DVI_DDC:
+ val = s->regs.gpio_dvi_ddc;
+ break;
+ case GPIO_MONID ... GPIO_MONID + 3:
+ val = ati_reg_read_offs(s->regs.gpio_monid,
+ addr - GPIO_MONID, size);
+ break;
case PALETTE_INDEX:
/* FIXME unaligned access */
val = vga_ioport_read(&s->vga, VGA_PEL_IR) << 16;
@@ -497,7 +525,28 @@ static void ati_mm_write(void *opaque, hwaddr addr,
s->regs.dac_cntl = data & 0xffffe3ff;
s->vga.dac_8bit = !!(data & DAC_8BIT_EN);
break;
-/* case GPIO_MONID: FIXME hook up DDC I2C here */
+ case GPIO_VGA_DDC:
+ if (s->dev_id != PCI_DEVICE_ID_ATI_RAGE128_PF) {
+ /* FIXME: Maybe add a property to select VGA or DVI port? */
+ }
+ break;
+ case GPIO_DVI_DDC:
+ if (s->dev_id != PCI_DEVICE_ID_ATI_RAGE128_PF) {
+ s->regs.gpio_dvi_ddc = ati_i2c(s->bbi2c, data, 0);
+ }
+ break;
+ case GPIO_MONID ... GPIO_MONID + 3:
+ /* FIXME What does Radeon have here? */
+ if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) {
+ /* Rage128p accesses DDC used to get EDID on these pins */
+ ati_reg_write_offs(&s->regs.gpio_monid,
+ addr - GPIO_MONID, data, size);
+ if ((s->regs.gpio_monid & BIT(25)) &&
+ addr <= GPIO_MONID + 2 && addr + size > GPIO_MONID + 2) {
+ s->regs.gpio_monid = ati_i2c(s->bbi2c, s->regs.gpio_monid, 1);
+ }
+ }
+ break;
case PALETTE_INDEX ... PALETTE_INDEX + 3:
if (size == 4) {
vga_ioport_write(&s->vga, VGA_PEL_IR, (data >> 16) & 0xff);
@@ -788,6 +837,12 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)
vga->cursor_draw_line = ati_cursor_draw_line;
}
+ /* ddc, edid */
+ I2CBus *i2cbus = i2c_init_bus(DEVICE(s), "ati-vga.ddc");
+ s->bbi2c = bitbang_i2c_init(i2cbus);
+ I2CSlave *i2cddc = I2C_SLAVE(qdev_create(BUS(i2cbus), TYPE_I2CDDC));
+ i2c_set_slave_address(i2cddc, 0x50);
+
/* mmio register space */
memory_region_init_io(&s->mm, OBJECT(s), &ati_mm_ops, s,
"ati.mmregs", 0x4000);
@@ -813,6 +868,7 @@ static void ati_vga_exit(PCIDevice *dev)
ATIVGAState *s = ATI_VGA(dev);
graphic_console_close(s->vga.con);
+ g_free(s->bbi2c);
}
static Property ati_vga_properties[] = {
diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h
index 2f426064cf..51465f5630 100644
--- a/hw/display/ati_int.h
+++ b/hw/display/ati_int.h
@@ -10,6 +10,7 @@
#define ATI_INT_H
#include "hw/pci/pci.h"
+#include "hw/i2c/bitbang_i2c.h"
#include "vga_int.h"
/*#define DEBUG_ATI*/
@@ -35,6 +36,9 @@ typedef struct ATIVGARegs {
uint32_t crtc_gen_cntl;
uint32_t crtc_ext_cntl;
uint32_t dac_cntl;
+ uint32_t gpio_vga_ddc;
+ uint32_t gpio_dvi_ddc;
+ uint32_t gpio_monid;
uint32_t crtc_h_total_disp;
uint32_t crtc_h_sync_strt_wid;
uint32_t crtc_v_total_disp;
@@ -83,6 +87,7 @@ typedef struct ATIVGAState {
uint16_t cursor_size;
uint32_t cursor_offset;
QEMUCursor *cursor;
+ bitbang_i2c_interface *bbi2c;
MemoryRegion io;
MemoryRegion mm;
ATIVGARegs regs;
diff --git a/hw/display/ati_regs.h b/hw/display/ati_regs.h
index 923bfd33ce..1ec3498b73 100644
--- a/hw/display/ati_regs.h
+++ b/hw/display/ati_regs.h
@@ -37,6 +37,8 @@
#define CRTC_GEN_CNTL 0x0050
#define CRTC_EXT_CNTL 0x0054
#define DAC_CNTL 0x0058
+#define GPIO_VGA_DDC 0x0060
+#define GPIO_DVI_DDC 0x0064
#define GPIO_MONID 0x0068
#define I2C_CNTL_1 0x0094
#define PALETTE_INDEX 0x00b0
--
2.13.7
^ permalink raw reply related
* [PATCH nftables v2] exthdr: doc: add support for matching IPv4 options
From: Stephen Suryaputra @ 2019-06-20 11:59 UTC (permalink / raw)
To: netfilter-devel; +Cc: Stephen Suryaputra
This is the userspace change for the overall changes with this
description:
Add capability to have rules matching IPv4 options. This is developed
mainly to support dropping of IP packets with loose and/or strict source
route route options.
v2: Removed options that aren't supported in the kernel (per Pablo Neira
Ayuso).
Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
---
doc/payload-expression.txt | 29 ++++-
include/Makefile.am | 1 +
include/exthdr.h | 1 +
include/ipopt.h | 27 +++++
include/linux/netfilter/nf_tables.h | 2 +
src/Makefile.am | 1 +
src/evaluate.c | 17 +++
src/exthdr.c | 22 +++-
src/ipopt.c | 159 ++++++++++++++++++++++++++++
src/parser_bison.y | 31 ++++++
src/payload.c | 4 +
src/scanner.l | 8 ++
tests/py/ip/ipopt.t | 24 +++++
tests/py/ip/ipopt.t.payload | 150 ++++++++++++++++++++++++++
14 files changed, 472 insertions(+), 4 deletions(-)
create mode 100644 include/ipopt.h
create mode 100644 src/ipopt.c
create mode 100644 tests/py/ip/ipopt.t
create mode 100644 tests/py/ip/ipopt.t.payload
diff --git a/doc/payload-expression.txt b/doc/payload-expression.txt
index 7f3ca42..218dd36 100644
--- a/doc/payload-expression.txt
+++ b/doc/payload-expression.txt
@@ -494,9 +494,9 @@ input meta iifname enp2s0 arp ptype 0x0800 arp htype 1 arp hlen 6 arp plen 4 @nh
EXTENSION HEADER EXPRESSIONS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Extension header expressions refer to data from variable-sized protocol headers, such as IPv6 extension headers and TCP options.
+Extension header expressions refer to data from variable-sized protocol headers, such as IPv6 extension headers, TCP options and IPv4 options.
-nftables currently supports matching (finding) a given ipv6 extension header or TCP option.
+nftables currently supports matching (finding) a given ipv6 extension header, TCP option or IPv4 option.
[verse]
*hbh* {*nexthdr* | *hdrlength*}
*frag* {*nexthdr* | *frag-off* | *more-fragments* | *id*}
@@ -505,11 +505,13 @@ nftables currently supports matching (finding) a given ipv6 extension header or
*mh* {*nexthdr* | *hdrlength* | *checksum* | *type*}
*srh* {*flags* | *tag* | *sid* | *seg-left*}
*tcp option* {*eol* | *noop* | *maxseg* | *window* | *sack-permitted* | *sack* | *sack0* | *sack1* | *sack2* | *sack3* | *timestamp*} 'tcp_option_field'
+*ip option* { lsrr | ra | rr | ssrr } 'ip_option_field'
The following syntaxes are valid only in a relational expression with boolean type on right-hand side for checking header existence only:
[verse]
*exthdr* {*hbh* | *frag* | *rt* | *dst* | *mh*}
*tcp option* {*eol* | *noop* | *maxseg* | *window* | *sack-permitted* | *sack* | *sack0* | *sack1* | *sack2* | *sack3* | *timestamp*}
+*ip option* { lsrr | ra | rr | ssrr }
.IPv6 extension headers
[options="header"]
@@ -568,6 +570,24 @@ TCP Timestamps |
kind, length, tsval, tsecr
|============================
+.IP Options
+[options="header"]
+|==================
+|Keyword| Description | IP option fields
+|lsrr|
+Loose Source Route |
+type, length, ptr, addr
+|ra|
+Router Alert |
+type, length, value
+|rr|
+Record Route |
+type, length, ptr, addr
+|ssrr|
+Strict Source Route |
+type, length, ptr, addr
+|============================
+
.finding TCP options
--------------------
filter input tcp option sack-permitted kind 1 counter
@@ -578,6 +598,11 @@ filter input tcp option sack-permitted kind 1 counter
ip6 filter input frag more-fragments 1 counter
---------------------------------------
+.finding IP option
+------------------
+filter input ip option lsrr exists counter
+---------------------------------------
+
CONNTRACK EXPRESSIONS
~~~~~~~~~~~~~~~~~~~~~
Conntrack expressions refer to meta data of the connection tracking entry associated with a packet. +
diff --git a/include/Makefile.am b/include/Makefile.am
index b1f4fcf..9606ae1 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -6,6 +6,7 @@ noinst_HEADERS = cli.h \
expression.h \
fib.h \
hash.h \
+ ipopt.h \
json.h \
mini-gmp.h \
gmputil.h \
diff --git a/include/exthdr.h b/include/exthdr.h
index 32f99c9..3959a65 100644
--- a/include/exthdr.h
+++ b/include/exthdr.h
@@ -3,6 +3,7 @@
#include <proto.h>
#include <tcpopt.h>
+#include <ipopt.h>
/**
* struct exthdr_desc - extension header description
diff --git a/include/ipopt.h b/include/ipopt.h
new file mode 100644
index 0000000..20710c3
--- /dev/null
+++ b/include/ipopt.h
@@ -0,0 +1,27 @@
+#ifndef NFTABLES_IPOPT_H
+#define NFTABLES_IPOPT_H
+
+#include <proto.h>
+#include <exthdr.h>
+#include <statement.h>
+
+extern struct expr *ipopt_expr_alloc(const struct location *loc,
+ uint8_t type, uint8_t field, uint8_t ptr);
+
+extern void ipopt_init_raw(struct expr *expr, uint8_t type,
+ unsigned int offset, unsigned int len,
+ uint32_t flags, bool set_unknown);
+
+extern bool ipopt_find_template(struct expr *expr, unsigned int offset,
+ unsigned int len);
+
+enum ipopt_fields {
+ IPOPT_FIELD_INVALID,
+ IPOPT_FIELD_TYPE,
+ IPOPT_FIELD_LENGTH,
+ IPOPT_FIELD_VALUE,
+ IPOPT_FIELD_PTR,
+ IPOPT_FIELD_ADDR_0,
+};
+
+#endif /* NFTABLES_IPOPT_H */
diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h
index 7bdb234..393bcb5 100644
--- a/include/linux/netfilter/nf_tables.h
+++ b/include/linux/netfilter/nf_tables.h
@@ -730,10 +730,12 @@ enum nft_exthdr_flags {
*
* @NFT_EXTHDR_OP_IPV6: match against ipv6 extension headers
* @NFT_EXTHDR_OP_TCP: match against tcp options
+ * @NFT_EXTHDR_OP_IPV4: match against ip options
*/
enum nft_exthdr_op {
NFT_EXTHDR_OP_IPV6,
NFT_EXTHDR_OP_TCPOPT,
+ NFT_EXTHDR_OP_IPV4,
__NFT_EXTHDR_OP_MAX
};
#define NFT_EXTHDR_OP_MAX (__NFT_EXTHDR_OP_MAX - 1)
diff --git a/src/Makefile.am b/src/Makefile.am
index 8e1a4d8..a45d8e3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -61,6 +61,7 @@ libnftables_la_SOURCES = \
nfnl_osf.c \
tcpopt.c \
socket.c \
+ ipopt.c \
libnftables.c
# yacc and lex generate dirty code
diff --git a/src/evaluate.c b/src/evaluate.c
index 21d9e14..fb66b46 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -518,6 +518,20 @@ static int __expr_evaluate_exthdr(struct eval_ctx *ctx, struct expr **exprp)
totlen, max_tcpoptlen);
break;
}
+ case NFT_EXTHDR_OP_IPV4: {
+ static const unsigned int max_ipoptlen = 40 * BITS_PER_BYTE;
+ unsigned int totlen = 0;
+
+ totlen += expr->exthdr.tmpl->offset;
+ totlen += expr->exthdr.tmpl->len;
+ totlen += expr->exthdr.offset;
+
+ if (totlen > max_ipoptlen)
+ return expr_error(ctx->msgs, expr,
+ "offset and size %u exceeds max ip option len (%u)",
+ totlen, max_ipoptlen);
+ break;
+ }
default:
break;
}
@@ -542,6 +556,9 @@ static int expr_evaluate_exthdr(struct eval_ctx *ctx, struct expr **exprp)
dependency = &proto_tcp;
pb = PROTO_BASE_TRANSPORT_HDR;
break;
+ case NFT_EXTHDR_OP_IPV4:
+ dependency = &proto_ip;
+ break;
case NFT_EXTHDR_OP_IPV6:
default:
dependency = &proto_ip6;
diff --git a/src/exthdr.c b/src/exthdr.c
index 0cd0319..d73cbcc 100644
--- a/src/exthdr.c
+++ b/src/exthdr.c
@@ -38,6 +38,11 @@ static void exthdr_expr_print(const struct expr *expr, struct output_ctx *octx)
if (offset)
nft_print(octx, "%d", offset);
nft_print(octx, " %s", expr->exthdr.tmpl->token);
+ } else if (expr->exthdr.op == NFT_EXTHDR_OP_IPV4) {
+ nft_print(octx, "ip option %s", expr->exthdr.desc->name);
+ if (expr->exthdr.flags & NFT_EXTHDR_F_PRESENT)
+ return;
+ nft_print(octx, " %s", expr->exthdr.tmpl->token);
} else {
if (expr->exthdr.flags & NFT_EXTHDR_F_PRESENT)
nft_print(octx, "exthdr %s", expr->exthdr.desc->name);
@@ -172,6 +177,8 @@ void exthdr_init_raw(struct expr *expr, uint8_t type,
assert(expr->etype == EXPR_EXTHDR);
if (op == NFT_EXTHDR_OP_TCPOPT)
return tcpopt_init_raw(expr, type, offset, len, flags);
+ if (op == NFT_EXTHDR_OP_IPV4)
+ return ipopt_init_raw(expr, type, offset, len, flags, true);
expr->len = len;
expr->exthdr.flags = flags;
@@ -222,7 +229,8 @@ bool exthdr_find_template(struct expr *expr, const struct expr *mask, unsigned i
{
unsigned int off, mask_offset, mask_len;
- if (expr->exthdr.tmpl != &exthdr_unknown_template)
+ if (expr->exthdr.op != NFT_EXTHDR_OP_IPV4 &&
+ expr->exthdr.tmpl != &exthdr_unknown_template)
return false;
/* In case we are handling tcp options instead of the default ipv6
@@ -237,8 +245,18 @@ bool exthdr_find_template(struct expr *expr, const struct expr *mask, unsigned i
off = expr->exthdr.offset;
off += round_up(mask->len, BITS_PER_BYTE) - mask_len;
+ /* Handle ip options after the offset and mask have been calculated. */
+ if (expr->exthdr.op == NFT_EXTHDR_OP_IPV4) {
+ if (ipopt_find_template(expr, off, mask_len - mask_offset)) {
+ *shift = mask_offset;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
exthdr_init_raw(expr, expr->exthdr.desc->type,
- off, mask_len - mask_offset, NFT_EXTHDR_OP_IPV6, 0);
+ off, mask_len - mask_offset, expr->exthdr.op, 0);
/* still failed to find a template... Bug. */
if (expr->exthdr.tmpl == &exthdr_unknown_template)
diff --git a/src/ipopt.c b/src/ipopt.c
new file mode 100644
index 0000000..f67a56f
--- /dev/null
+++ b/src/ipopt.c
@@ -0,0 +1,159 @@
+#include <stdint.h>
+
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/ip6.h>
+#include <netinet/tcp.h>
+
+#include <utils.h>
+#include <headers.h>
+#include <expression.h>
+#include <ipopt.h>
+
+static const struct proto_hdr_template ipopt_unknown_template =
+ PROTO_HDR_TEMPLATE("unknown", &invalid_type, BYTEORDER_INVALID, 0, 0);
+
+#define PHT(__token, __offset, __len) \
+ PROTO_HDR_TEMPLATE(__token, &integer_type, BYTEORDER_BIG_ENDIAN, \
+ __offset, __len)
+static const struct exthdr_desc ipopt_lsrr = {
+ .name = "lsrr",
+ .type = IPOPT_LSRR,
+ .templates = {
+ [IPOPT_FIELD_TYPE] = PHT("type", 0, 8),
+ [IPOPT_FIELD_LENGTH] = PHT("length", 8, 8),
+ [IPOPT_FIELD_PTR] = PHT("ptr", 16, 8),
+ [IPOPT_FIELD_ADDR_0] = PHT("addr", 24, 32),
+ },
+};
+
+static const struct exthdr_desc ipopt_rr = {
+ .name = "rr",
+ .type = IPOPT_RR,
+ .templates = {
+ [IPOPT_FIELD_TYPE] = PHT("type", 0, 8),
+ [IPOPT_FIELD_LENGTH] = PHT("length", 8, 8),
+ [IPOPT_FIELD_PTR] = PHT("ptr", 16, 8),
+ [IPOPT_FIELD_ADDR_0] = PHT("addr", 24, 32),
+ },
+};
+
+static const struct exthdr_desc ipopt_ssrr = {
+ .name = "ssrr",
+ .type = IPOPT_SSRR,
+ .templates = {
+ [IPOPT_FIELD_TYPE] = PHT("type", 0, 8),
+ [IPOPT_FIELD_LENGTH] = PHT("length", 8, 8),
+ [IPOPT_FIELD_PTR] = PHT("ptr", 16, 8),
+ [IPOPT_FIELD_ADDR_0] = PHT("addr", 24, 32),
+ },
+};
+
+static const struct exthdr_desc ipopt_ra = {
+ .name = "ra",
+ .type = IPOPT_RA,
+ .templates = {
+ [IPOPT_FIELD_TYPE] = PHT("type", 0, 8),
+ [IPOPT_FIELD_LENGTH] = PHT("length", 8, 8),
+ [IPOPT_FIELD_VALUE] = PHT("value", 16, 16),
+ },
+};
+
+static const struct exthdr_desc *ipopt_protocols[] = {
+ [IPOPT_LSRR] = &ipopt_lsrr,
+ [IPOPT_RR] = &ipopt_rr,
+ [IPOPT_SSRR] = &ipopt_ssrr,
+ [IPOPT_RA] = &ipopt_ra,
+};
+
+static unsigned int calc_offset(const struct exthdr_desc *desc,
+ const struct proto_hdr_template *tmpl,
+ unsigned int arg)
+{
+ if (!desc || tmpl == &ipopt_unknown_template)
+ return 0;
+
+ switch (desc->type) {
+ case IPOPT_RR:
+ case IPOPT_LSRR:
+ case IPOPT_SSRR:
+ if (tmpl == &desc->templates[IPOPT_FIELD_ADDR_0])
+ return (tmpl->offset < 24) ? 0 : arg;
+ return 0;
+ default:
+ return 0;
+ }
+}
+
+struct expr *ipopt_expr_alloc(const struct location *loc, uint8_t type,
+ uint8_t field, uint8_t ptr)
+{
+ const struct proto_hdr_template *tmpl;
+ const struct exthdr_desc *desc;
+ struct expr *expr;
+
+ desc = ipopt_protocols[type];
+ tmpl = &desc->templates[field];
+ if (!tmpl)
+ return NULL;
+
+ expr = expr_alloc(loc, EXPR_EXTHDR, tmpl->dtype,
+ BYTEORDER_BIG_ENDIAN, tmpl->len);
+ expr->exthdr.desc = desc;
+ expr->exthdr.tmpl = tmpl;
+ expr->exthdr.op = NFT_EXTHDR_OP_IPV4;
+ expr->exthdr.offset = calc_offset(desc, tmpl, ptr);
+
+ return expr;
+}
+
+void ipopt_init_raw(struct expr *expr, uint8_t type, unsigned int offset,
+ unsigned int len, uint32_t flags, bool set_unknown)
+{
+ const struct proto_hdr_template *tmpl;
+ unsigned int i;
+
+ assert(expr->etype == EXPR_EXTHDR);
+
+ expr->len = len;
+ expr->exthdr.flags = flags;
+ expr->exthdr.offset = offset;
+
+ assert(type < array_size(ipopt_protocols));
+ expr->exthdr.desc = ipopt_protocols[type];
+ expr->exthdr.flags = flags;
+
+ for (i = 0; i < array_size(expr->exthdr.desc->templates); ++i) {
+ tmpl = &expr->exthdr.desc->templates[i];
+
+ /* Make sure that it's the right template based on offset and len */
+ if (tmpl->offset != offset || tmpl->len != len)
+ continue;
+
+ if (flags & NFT_EXTHDR_F_PRESENT)
+ expr->dtype = &boolean_type;
+ else
+ expr->dtype = tmpl->dtype;
+ expr->exthdr.tmpl = tmpl;
+ expr->exthdr.op = NFT_EXTHDR_OP_IPV4;
+ break;
+ }
+ if (i == array_size(expr->exthdr.desc->templates) && set_unknown) {
+ expr->exthdr.tmpl = &ipopt_unknown_template;
+ expr->exthdr.op = NFT_EXTHDR_OP_IPV4;
+ }
+}
+
+bool ipopt_find_template(struct expr *expr, unsigned int offset,
+ unsigned int len)
+{
+ if (expr->exthdr.tmpl != &ipopt_unknown_template)
+ return false;
+
+ ipopt_init_raw(expr, expr->exthdr.desc->type, offset, len, 0, false);
+
+ if (expr->exthdr.tmpl == &ipopt_unknown_template)
+ return false;
+
+ return true;
+}
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 9e632c0..5bbc6d5 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -309,6 +309,14 @@ int nft_lex(void *, void *, void *);
%token PROTOCOL "protocol"
%token CHECKSUM "checksum"
+%token PTR "ptr"
+%token VALUE "value"
+
+%token LSRR "lsrr"
+%token RR "rr"
+%token SSRR "ssrr"
+%token RA "ra"
+
%token ICMP "icmp"
%token CODE "code"
%token SEQUENCE "seq"
@@ -698,6 +706,7 @@ int nft_lex(void *, void *, void *);
%type <expr> ip_hdr_expr icmp_hdr_expr igmp_hdr_expr numgen_expr hash_expr
%destructor { expr_free($$); } ip_hdr_expr icmp_hdr_expr igmp_hdr_expr numgen_expr hash_expr
%type <val> ip_hdr_field icmp_hdr_field igmp_hdr_field
+%type <val> ip_option_type ip_option_field
%type <expr> ip6_hdr_expr icmp6_hdr_expr
%destructor { expr_free($$); } ip6_hdr_expr icmp6_hdr_expr
%type <val> ip6_hdr_field icmp6_hdr_field
@@ -4249,6 +4258,15 @@ ip_hdr_expr : IP ip_hdr_field
{
$$ = payload_expr_alloc(&@$, &proto_ip, $2);
}
+ | IP OPTION ip_option_type ip_option_field
+ {
+ $$ = ipopt_expr_alloc(&@$, $3, $4, 0);
+ }
+ | IP OPTION ip_option_type
+ {
+ $$ = ipopt_expr_alloc(&@$, $3, IPOPT_FIELD_TYPE, 0);
+ $$->exthdr.flags = NFT_EXTHDR_F_PRESENT;
+ }
;
ip_hdr_field : HDRVERSION { $$ = IPHDR_VERSION; }
@@ -4265,6 +4283,19 @@ ip_hdr_field : HDRVERSION { $$ = IPHDR_VERSION; }
| DADDR { $$ = IPHDR_DADDR; }
;
+ip_option_type : LSRR { $$ = IPOPT_LSRR; }
+ | RR { $$ = IPOPT_RR; }
+ | SSRR { $$ = IPOPT_SSRR; }
+ | RA { $$ = IPOPT_RA; }
+ ;
+
+ip_option_field : TYPE { $$ = IPOPT_FIELD_TYPE; }
+ | LENGTH { $$ = IPOPT_FIELD_LENGTH; }
+ | VALUE { $$ = IPOPT_FIELD_VALUE; }
+ | PTR { $$ = IPOPT_FIELD_PTR; }
+ | ADDR { $$ = IPOPT_FIELD_ADDR_0; }
+ ;
+
icmp_hdr_expr : ICMP icmp_hdr_field
{
$$ = payload_expr_alloc(&@$, &proto_icmp, $2);
diff --git a/src/payload.c b/src/payload.c
index 338a4b7..931370f 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -524,6 +524,10 @@ void exthdr_dependency_kill(struct payload_dep_ctx *ctx, struct expr *expr,
if (payload_dependency_exists(ctx, PROTO_BASE_NETWORK_HDR))
payload_dependency_release(ctx);
break;
+ case NFT_EXTHDR_OP_IPV4:
+ if (payload_dependency_exists(ctx, PROTO_BASE_NETWORK_HDR))
+ payload_dependency_release(ctx);
+ break;
default:
break;
}
diff --git a/src/scanner.l b/src/scanner.l
index 558bf92..8432250 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -401,6 +401,14 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
"protocol" { return PROTOCOL; }
"checksum" { return CHECKSUM; }
+"lsrr" { return LSRR; }
+"rr" { return RR; }
+"ssrr" { return SSRR; }
+"ra" { return RA; }
+
+"value" { return VALUE; }
+"ptr" { return PTR; }
+
"echo" { return ECHO; }
"eol" { return EOL; }
"maxseg" { return MAXSEG; }
diff --git a/tests/py/ip/ipopt.t b/tests/py/ip/ipopt.t
new file mode 100644
index 0000000..161fcc4
--- /dev/null
+++ b/tests/py/ip/ipopt.t
@@ -0,0 +1,24 @@
+:input;type filter hook input priority 0
+
+*ip;test-ipopt;input
+
+ip option lsrr type 1;ok
+ip option lsrr length 1;ok
+ip option lsrr ptr 1;ok
+ip option lsrr addr 1;ok
+ip option rr type 1;ok
+ip option rr length 1;ok
+ip option rr ptr 1;ok
+ip option rr addr 1;ok
+ip option ssrr type 1;ok
+ip option ssrr length 1;ok
+ip option ssrr ptr 1;ok
+ip option ssrr addr 1;ok
+ip option ra type 1;ok
+ip option ra length 1;ok
+ip option ra value 1;ok
+
+ip option foobar;fail
+ip option foo bar;fail
+ip option lsrr type;fail
+ip option lsrr flag 1;fail
diff --git a/tests/py/ip/ipopt.t.payload b/tests/py/ip/ipopt.t.payload
new file mode 100644
index 0000000..7be197f
--- /dev/null
+++ b/tests/py/ip/ipopt.t.payload
@@ -0,0 +1,150 @@
+# ip option lsrr type 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 131 + 0 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option lsrr length 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 131 + 1 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option lsrr ptr 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 131 + 2 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option lsrr addr 1
+ip test-ipopt input
+ [ exthdr load ipv4 4b @ 131 + 3 => reg 1 ]
+ [ cmp eq reg 1 0x01000000 ]
+
+# ip option rr type 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 7 + 0 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option rr length 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 7 + 1 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option rr ptr 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 7 + 2 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option rr addr 1
+ip test-ipopt input
+ [ exthdr load ipv4 4b @ 7 + 3 => reg 1 ]
+ [ cmp eq reg 1 0x01000000 ]
+
+# ip option ssrr type 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 137 + 0 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option ssrr length 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 137 + 1 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option ssrr ptr 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 137 + 2 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option ssrr addr 1
+ip test-ipopt input
+ [ exthdr load ipv4 4b @ 137 + 3 => reg 1 ]
+ [ cmp eq reg 1 0x01000000 ]
+
+# ip option ra type 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 148 + 0 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option ra length 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 148 + 1 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option ra value 1
+ip test-ipopt input
+ [ exthdr load ipv4 2b @ 148 + 2 => reg 1 ]
+ [ cmp eq reg 1 0x00000100 ]
+
+# ip option lsrr type 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 131 + 0 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option lsrr length 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 131 + 1 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option lsrr ptr 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 131 + 2 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option lsrr addr 1
+ip test-ipopt input
+ [ exthdr load ipv4 4b @ 131 + 3 => reg 1 ]
+ [ cmp eq reg 1 0x01000000 ]
+
+# ip option rr type 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 7 + 0 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option rr length 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 7 + 1 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option rr ptr 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 7 + 2 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option rr addr 1
+ip test-ipopt input
+ [ exthdr load ipv4 4b @ 7 + 3 => reg 1 ]
+ [ cmp eq reg 1 0x01000000 ]
+
+# ip option ssrr type 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 137 + 0 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option ssrr length 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 137 + 1 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option ssrr ptr 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 137 + 2 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option ssrr addr 1
+ip test-ipopt input
+ [ exthdr load ipv4 4b @ 137 + 3 => reg 1 ]
+ [ cmp eq reg 1 0x01000000 ]
+
+# ip option ra type 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 148 + 0 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option ra length 1
+ip test-ipopt input
+ [ exthdr load ipv4 1b @ 148 + 1 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ip option ra value 1
+ip test-ipopt input
+ [ exthdr load ipv4 2b @ 148 + 2 => reg 1 ]
+ [ cmp eq reg 1 0x00000100 ]
+
--
2.17.1
^ permalink raw reply related
* [PATCH] cpuidle/drivers/mobile: Add new governor for mobile/embedded systems
From: Daniel Lezcano @ 2019-06-20 11:58 UTC (permalink / raw)
To: rafael
Cc: linux-kernel, Rafael J. Wysocki, Thomas Gleixner,
Greg Kroah-Hartman, open list:CPU IDLE TIME MANAGEMENT FRAMEWORK
The objective is the same for all the governors: save energy, but at
the end the governors menu, ladder and teo aim to improve the
performances with an acceptable energy drop for some workloads which
are identified for servers and desktops (with the help of a firmware).
The ladder governor is designed for server with a periodic tick
configuration.
The menu governor does not behave nicely with the mobile platform and
the energy saving for the multimedia workloads is worst than picking
up randomly an idle state.
The teo governor acts efficiently, it promotes shallower state for
performances which is perfect for the servers / desktop but inadequate
for mobile because the energy consumed is too high.
It is very difficult to do changes in these governors for embedded
systems without impacting performances on servers/desktops or ruin the
optimizations for the workloads on these platforms.
The mobile governor is a new governor targeting embedded systems
running on battery where the energy saving has a higher priority than
servers or desktops. This governor aims to save energy as much as
possible but with a performance degradation tolerance.
In this way, we can optimize the governor for specific mobile workload
and more generally embedded systems without impacting other platforms.
The mobile governor is built on top of the paradigm 'separate the wake
up sources signals and analyze them'. Three categories of wake up
signals are identified:
- deterministic : timers
- predictable : most of the devices interrupt
- unpredictable : IPI rescheduling, random signals
The latter needs an iterative approach and the help of the scheduler
to give more input to the governor.
The governor uses the irq timings where we predict the next interrupt
occurrences on the current CPU and the next timer. It is well suited
for mobile and more generally embedded systems where the interrupts
are usually pinned on one CPU and where the power is more important
than the performances.
The multimedia applications on the embedded system spawn multiple
threads which are migrated across the different CPUs and waking
between them up. In order to catch this situation we have also to
track the idle task rescheduling duration with a relative degree of
confidence as the scheduler is involved in the task migrations. The
resched information is in the scope of the governor via the reflect
callback.
The governor begins with a clean foundation basing the prediction on
the irq behavior returned by the irq timings, the timers and the idle
task rescheduling. The advantage of the approach is we have a full
view of the wakeup sources as we identify them separately and then we
can control the situation without relying on biased heuristics.
This first iteration provides a basic prediction but improves on some
mobile platforms better energy for better performance for multimedia
workloads.
The scheduling aspect will be optimized iteratively with non
regression testing for previous identified workloads on an Android
reference platform.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/cpuidle/Kconfig | 11 ++-
drivers/cpuidle/governors/Makefile | 1 +
drivers/cpuidle/governors/mobile.c | 151 +++++++++++++++++++++++++++++
3 files changed, 162 insertions(+), 1 deletion(-)
create mode 100644 drivers/cpuidle/governors/mobile.c
diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
index a4ac31e4a58c..e2376d85e288 100644
--- a/drivers/cpuidle/Kconfig
+++ b/drivers/cpuidle/Kconfig
@@ -5,7 +5,7 @@ config CPU_IDLE
bool "CPU idle PM support"
default y if ACPI || PPC_PSERIES
select CPU_IDLE_GOV_LADDER if (!NO_HZ && !NO_HZ_IDLE)
- select CPU_IDLE_GOV_MENU if (NO_HZ || NO_HZ_IDLE) && !CPU_IDLE_GOV_TEO
+ select CPU_IDLE_GOV_MENU if (NO_HZ || NO_HZ_IDLE) && !CPU_IDLE_GOV_TEO && !CPU_IDLE_GOV_MOBILE
help
CPU idle is a generic framework for supporting software-controlled
idle processor power management. It includes modular cross-platform
@@ -33,6 +33,15 @@ config CPU_IDLE_GOV_TEO
Some workloads benefit from using it and it generally should be safe
to use. Say Y here if you are not happy with the alternatives.
+config CPU_IDLE_GOV_MOBILE
+ bool "Mobile governor"
+ select IRQ_TIMINGS
+ help
+ The mobile governor is based on irq timings measurements and
+ pattern research combined with the next timer. This governor
+ suits very well on embedded systems where the interrupts are
+ grouped on a single core and the power is the priority.
+
config DT_IDLE_STATES
bool
diff --git a/drivers/cpuidle/governors/Makefile b/drivers/cpuidle/governors/Makefile
index 42f44cc610dd..f09da7178670 100644
--- a/drivers/cpuidle/governors/Makefile
+++ b/drivers/cpuidle/governors/Makefile
@@ -6,3 +6,4 @@
obj-$(CONFIG_CPU_IDLE_GOV_LADDER) += ladder.o
obj-$(CONFIG_CPU_IDLE_GOV_MENU) += menu.o
obj-$(CONFIG_CPU_IDLE_GOV_TEO) += teo.o
+obj-$(CONFIG_CPU_IDLE_GOV_MOBILE) += mobile.o
diff --git a/drivers/cpuidle/governors/mobile.c b/drivers/cpuidle/governors/mobile.c
new file mode 100644
index 000000000000..8fda0f9b960b
--- /dev/null
+++ b/drivers/cpuidle/governors/mobile.c
@@ -0,0 +1,151 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019, Linaro Ltd
+ * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
+ */
+#include <linux/cpuidle.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/tick.h>
+#include <linux/interrupt.h>
+#include <linux/sched/clock.h>
+
+struct mobile_device {
+ u64 idle_ema_avg;
+ u64 idle_total;
+ unsigned long last_jiffies;
+};
+
+#define EMA_ALPHA_VAL 64
+#define EMA_ALPHA_SHIFT 7
+#define MAX_RESCHED_INTERVAL_MS 100
+
+static DEFINE_PER_CPU(struct mobile_device, mobile_devices);
+
+static int mobile_ema_new(s64 value, s64 ema_old)
+{
+ if (likely(ema_old))
+ return ema_old + (((value - ema_old) * EMA_ALPHA_VAL) >>
+ EMA_ALPHA_SHIFT);
+ return value;
+}
+
+static void mobile_reflect(struct cpuidle_device *dev, int index)
+{
+ struct mobile_device *mobile_dev = this_cpu_ptr(&mobile_devices);
+ struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
+ struct cpuidle_state *s = &drv->states[index];
+ int residency;
+
+ /*
+ * The idle task was not rescheduled since
+ * MAX_RESCHED_INTERVAL_MS, let's consider the duration is
+ * long enough to clear our stats.
+ */
+ if (time_after(jiffies, mobile_dev->last_jiffies +
+ msecs_to_jiffies(MAX_RESCHED_INTERVAL_MS)))
+ mobile_dev->idle_ema_avg = 0;
+
+ /*
+ * Sum all the residencies in order to compute the total
+ * duration of the idle task.
+ */
+ residency = dev->last_residency - s->exit_latency;
+ if (residency > 0)
+ mobile_dev->idle_total += residency;
+
+ /*
+ * We exited the idle state with the need_resched() flag, the
+ * idle task will be rescheduled, so store the duration the
+ * idle task was scheduled in an exponential moving average and
+ * reset the total of the idle duration.
+ */
+ if (need_resched()) {
+ mobile_dev->idle_ema_avg = mobile_ema_new(mobile_dev->idle_total,
+ mobile_dev->idle_ema_avg);
+ mobile_dev->idle_total = 0;
+ mobile_dev->last_jiffies = jiffies;
+ }
+}
+
+static int mobile_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
+ bool *stop_tick)
+{
+ struct mobile_device *mobile_dev = this_cpu_ptr(&mobile_devices);
+ int latency_req = cpuidle_governor_latency_req(dev->cpu);
+ int i, index = 0;
+ ktime_t delta_next;
+ u64 now, irq_length, timer_length;
+ u64 idle_duration_us;
+
+ /*
+ * Get the present time as reference for the next steps
+ */
+ now = local_clock();
+
+ /*
+ * Get the next interrupt event giving the 'now' as a
+ * reference, if the next event appears to have already
+ * expired then we get the 'now' returned which ends up with a
+ * zero duration.
+ */
+ irq_length = irq_timings_next_event(now) - now;
+
+ /*
+ * Get the timer duration before expiration.
+ */
+ timer_length = ktime_to_ns(tick_nohz_get_sleep_length(&delta_next));
+
+ /*
+ * Get the smallest duration between the timer and the irq next event.
+ */
+ idle_duration_us = min_t(u64, irq_length, timer_length) / NSEC_PER_USEC;
+
+ /*
+ * Get the idle task duration average if the information is
+ * available.
+ */
+ if (mobile_dev->idle_ema_avg)
+ idle_duration_us = min_t(u64, idle_duration_us,
+ mobile_dev->idle_ema_avg);
+
+ for (i = 0; i < drv->state_count; i++) {
+ struct cpuidle_state *s = &drv->states[i];
+ struct cpuidle_state_usage *su = &dev->states_usage[i];
+
+ if (s->disabled || su->disable)
+ continue;
+
+ if (s->exit_latency > latency_req)
+ break;
+
+ if (idle_duration_us > s->exit_latency)
+ idle_duration_us = idle_duration_us - s->exit_latency;
+
+ if (s->target_residency > idle_duration_us)
+ break;
+
+ index = i;
+ }
+
+ if (!index)
+ *stop_tick = false;
+
+ return index;
+}
+
+static struct cpuidle_governor mobile_governor = {
+ .name = "mobile",
+ .rating = 20,
+ .select = mobile_select,
+ .reflect = mobile_reflect,
+};
+
+static int __init init_governor(void)
+{
+ irq_timings_enable();
+ return cpuidle_register_governor(&mobile_governor);
+}
+
+postcore_initcall(init_governor);
--
2.17.1
^ permalink raw reply related
* Re: [RFC bpf-next 0/7] Programming socket lookup with BPF
From: Florian Westphal @ 2019-06-20 11:56 UTC (permalink / raw)
To: Jakub Sitnicki; +Cc: Florian Westphal, netdev, bpf, kernel-team
In-Reply-To: <87sgs6ey43.fsf@cloudflare.com>
Jakub Sitnicki <jakub@cloudflare.com> wrote:
> > Sorry for the question, but where is the problem?
> > (i.e., is it with TPROXY or bpf side)?
>
> The way I see it is that the problem is that we have mappings for
> steering traffic into sockets split between two places: (1) the socket
> lookup tables, and (2) the TPROXY rules.
>
> BPF programs that need to check if there is a socket the packet is
> destined for have access to the socket lookup tables, via the mentioned
> bpf_sk_lookup helper, but are unaware of TPROXY redirects.
Oh, right.
[ TPROXY setup ]
Thanks for sharing, it will take me some time to digest this.
It would be good to have a simpler way to express this.
> One thing I haven't touched on in the cover letter is that to use TPROXY
> you need to set IP_TRANSPARENT on the listening socket. This requires
> that your process runs with CAP_NET_RAW or CAP_NET_ADMIN, or that you
> get the socket from systemd.
>
> I haven't been able to explain why the process needs to be privileged to
> receive traffic steered with TPROXY, but it turns out to be a pain point
> too. We end up having to lock down the service to ensure it doesn't use
> the elevated privileges for anything else than setting IP_TRANSPARENT.
Marek thinks its security measure:
1. TPROXY rule to redirect 80 to 8080 is added
2. UNPRIV binds 8080 -> Unpriv can then intercept packets for privileged
port (it can't, as TPROXY rule refuses to redirect to sk that did not
have IP_TRANSPARENT set).
AFAICS purely from stack pov, it sets IP_REPLY_ARG_NOSRCCHECK which in
turn sets FLOWI_FLAG_ANYSRC which bypasses a "fl->saddr is configured on
this machine" check in ip_route_output_key_hash_rcu.
I did not yet find similar entanglement for ipv6, will check.
^ permalink raw reply
* Re: [Qemu-devel] [PATCH v1 12/17] tests/vm: freebsd autoinstall, using serial console
From: Alex Bennée @ 2019-06-20 11:01 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Fam Zheng, Thomas Huth, qemu-devel, Gerd Hoffmann
In-Reply-To: <d9b49b4d-424b-1ad1-511e-fc5ad7cdafe6@redhat.com>
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> On 6/19/19 9:40 PM, Alex Bennée wrote:
>> From: Gerd Hoffmann <kraxel@redhat.com>
>>
>> Instead of fetching the prebuilt image from patchew download the install
>> iso and prepare the image locally. Install to disk, using the serial
>> console. Create qemu user, configure ssh login. Install packages
>> needed for qemu builds.
>>
>> Note that freebsd package downloads are delivered as non-cachable
>> content, so I had to configure squid with "ignore-no-store
>> ignore-private ignore-reload" for pkgmir.geo.freebsd.org to make the
>> caching actually work.
>>
>> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Tested-by: Thomas Huth <thuth@redhat.com>
>> Message-Id: <20190617043858.8290-9-kraxel@redhat.com>
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
So I do have a check for this in my PR scripts. I guess I should
replicate it in my patch series workflow.
>
>> ---
>> tests/vm/freebsd | 182 ++++++++++++++++++++++++++++++++++++++++++++---
>> 1 file changed, 172 insertions(+), 10 deletions(-)
>>
>> diff --git a/tests/vm/freebsd b/tests/vm/freebsd
>> index 091be1a065..2a19461a90 100755
>> --- a/tests/vm/freebsd
>> +++ b/tests/vm/freebsd
>> @@ -2,41 +2,203 @@
>> #
>> # FreeBSD VM image
>> #
>> -# Copyright 2017 Red Hat Inc.
>> +# Copyright 2017-2019 Red Hat Inc.
>> #
>> # Authors:
>> # Fam Zheng <famz@redhat.com>
>> +# Gerd Hoffmann <kraxel@redhat.com>
>> #
>> # This code is licensed under the GPL version 2 or later. See
>> # the COPYING file in the top-level directory.
>> #
>>
>> import os
>> +import re
>> import sys
>> +import time
>> +import socket
>> import subprocess
>> import basevm
>>
>> class FreeBSDVM(basevm.BaseVM):
>> name = "freebsd"
>> arch = "x86_64"
>> +
>> + link = "https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.0/FreeBSD-12.0-RELEASE-amd64-disc1.iso.xz"
>> + csum = "1d40015bea89d05b8bd13e2ed80c40b522a9ec1abd8e7c8b80954fb485fb99db"
>> + size = "20G"
>> + pkgs = [
>> + # build tools
>> + "git",
>> + "pkgconf",
>> + "bzip2",
>> +
>> + # gnu tools
>> + "bash",
>> + "gmake",
>> + "gsed",
>> + "flex", "bison",
>> +
>> + # libs: crypto
>> + "gnutls",
>> +
>> + # libs: images
>> + "jpeg-turbo",
>> + "png",
>> +
>> + # libs: ui
>> + "sdl2",
>> + "gtk3",
>> + "libxkbcommon",
>> +
>> + # libs: opengl
>> + "libepoxy",
>> + "mesa-libs",
>> + ]
>> +
>> BUILD_SCRIPT = """
>> set -e;
>> - rm -rf /var/tmp/qemu-test.*
>> - cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
>> + rm -rf /home/qemu/qemu-test.*
>> + cd $(mktemp -d /home/qemu/qemu-test.XXXXXX);
>> + mkdir src build; cd src;
>> tar -xf /dev/vtbd1;
>> - ./configure {configure_opts};
>> + cd ../build
>> + ../src/configure --python=python3.6 {configure_opts};
>> gmake --output-sync -j{jobs} {target} {verbose};
>> """
>>
>> + def console_boot_serial(self):
>> + self.console_wait_send("Autoboot", "3")
>> + self.console_wait_send("OK", "set console=comconsole\n")
>> + self.console_wait_send("OK", "boot\n")
>> +
>> def build_image(self, img):
>> - cimg = self._download_with_cache("http://download.patchew.org/freebsd-11.1-amd64.img.xz",
>> - sha256sum='adcb771549b37bc63826c501f05121a206ed3d9f55f49145908f7e1432d65891')
>> - img_tmp_xz = img + ".tmp.xz"
>> + self.print_step("Downloading install iso")
>> + cimg = self._download_with_cache(self.link, sha256sum=self.csum)
>> img_tmp = img + ".tmp"
>> - sys.stderr.write("Extracting the image...\n")
>> - subprocess.check_call(["ln", "-f", cimg, img_tmp_xz])
>> - subprocess.check_call(["xz", "--keep", "-dvf", img_tmp_xz])
>> + iso = img + ".install.iso"
>> + iso_xz = iso + ".xz"
>> +
>> + self.print_step("Preparing iso and disk image")
>> + subprocess.check_call(["cp", "-f", cimg, iso_xz])
>> + subprocess.check_call(["xz", "-dvf", iso_xz])
>> + subprocess.check_call(["qemu-img", "create", "-f", "qcow2",
>> + img_tmp, self.size])
>> +
>> + self.print_step("Booting installer")
>> + self.boot(img_tmp, extra_args = [
>> + "-bios", "pc-bios/bios-256k.bin",
>> + "-machine", "graphics=off",
>> + "-cdrom", iso
>> + ])
>> + self.console_init()
>> + self.console_boot_serial()
>> + self.console_wait_send("Console type", "xterm\n")
>> +
>> + # pre-install configuration
>> + self.console_wait_send("Welcome", "\n")
>> + self.console_wait_send("Keymap Selection", "\n")
>> + self.console_wait_send("Set Hostname", "freebsd\n")
>> + self.console_wait_send("Distribution Select", "\n")
>> + self.console_wait_send("Partitioning", "\n")
>> + self.console_wait_send("Partition", "\n")
>> + self.console_wait_send("Scheme", "\n")
>> + self.console_wait_send("Editor", "f")
>> + self.console_wait_send("Confirmation", "c")
>> +
>> + self.print_step("Installation started now, this will take a while")
>> +
>> + # post-install configuration
>> + self.console_wait("New Password:")
>> + self.console_send("%s\n" % self.ROOT_PASS)
>> + self.console_wait("Retype New Password:")
>> + self.console_send("%s\n" % self.ROOT_PASS)
>> +
>> + self.console_wait_send("Network Configuration", "\n")
>> + self.console_wait_send("IPv4", "y")
>> + self.console_wait_send("DHCP", "y")
>> + self.console_wait_send("IPv6", "n")
>> + self.console_wait_send("Resolver", "\n")
>> +
>> + self.console_wait_send("Time Zone Selector", "a\n")
>> + self.console_wait_send("Confirmation", "y")
>> + self.console_wait_send("Time & Date", "\n")
>> + self.console_wait_send("Time & Date", "\n")
>> +
>> + self.console_wait_send("System Configuration", "\n")
>> + self.console_wait_send("System Hardening", "\n")
>> +
>> + # qemu user
>> + self.console_wait_send("Add User Accounts", "y")
>> + self.console_wait("Username")
>> + self.console_send("%s\n" % self.GUEST_USER)
>> + self.console_wait("Full name")
>> + self.console_send("%s\n" % self.GUEST_USER)
>> + self.console_wait_send("Uid", "\n")
>> + self.console_wait_send("Login group", "\n")
>> + self.console_wait_send("Login group", "\n")
>> + self.console_wait_send("Login class", "\n")
>> + self.console_wait_send("Shell", "\n")
>> + self.console_wait_send("Home directory", "\n")
>> + self.console_wait_send("Home directory perm", "\n")
>> + self.console_wait_send("Use password", "\n")
>> + self.console_wait_send("Use an empty password", "\n")
>> + self.console_wait_send("Use a random password", "\n")
>> + self.console_wait("Enter password:")
>> + self.console_send("%s\n" % self.GUEST_PASS)
>> + self.console_wait("Enter password again:")
>> + self.console_send("%s\n" % self.GUEST_PASS)
>> + self.console_wait_send("Lock out", "\n")
>> + self.console_wait_send("OK", "yes\n")
>> + self.console_wait_send("Add another user", "no\n")
>> +
>> + self.console_wait_send("Final Configuration", "\n")
>> + self.console_wait_send("Manual Configuration", "\n")
>> + self.console_wait_send("Complete", "\n")
>> +
>> + self.print_step("Installation finished, rebooting")
>> + self.console_boot_serial()
>> +
>> + # setup qemu user
>> + prompt = "$"
>> + self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS)
>> + self.console_wait_send(prompt, "exit\n")
>> +
>> + # setup root user
>> + prompt = "root@freebsd:~ #"
>> + self.console_ssh_init(prompt, "root", self.ROOT_PASS)
>> + self.console_sshd_config(prompt)
>> +
>> + # setup serial console
>> + self.console_wait(prompt)
>> + self.console_send("echo 'console=comconsole' >> /boot/loader.conf\n")
>> +
>> + # setup boot delay
>> + self.console_wait(prompt)
>> + self.console_send("echo 'autoboot_delay=1' >> /boot/loader.conf\n")
>> +
>> + # setup virtio-blk #1 (tarfile)
>> + self.console_wait(prompt)
>> + self.console_send("echo 'chmod 666 /dev/vtbd1' >> /etc/rc.local\n")
>> +
>> + self.print_step("Configuration finished, rebooting")
>> + self.console_wait_send(prompt, "reboot\n")
>> + self.console_wait("login:")
>> + self.wait_ssh()
>> +
>> + self.print_step("Installing packages")
>> + self.ssh_root_check("pkg install -y %s\n" % " ".join(self.pkgs))
>> +
>> + # shutdown
>> + self.ssh_root(self.poweroff)
>> + self.console_wait("Uptime:")
>> + self.wait()
>> +
>> + if os.path.exists(img):
>> + os.remove(img)
>> os.rename(img_tmp, img)
>> + os.remove(iso)
>> + self.print_step("All done")
>>
>> if __name__ == "__main__":
>> sys.exit(basevm.main(FreeBSDVM))
>>
--
Alex Bennée
^ permalink raw reply
* [Qemu-devel] [PATCH v5 1/2] i2c: Move bitbang_i2c.h to include/hw/i2c/
From: BALATON Zoltan @ 2019-06-20 10:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Corey Minyard, Gerd Hoffmann
In-Reply-To: <cover.1561028123.git.balaton@eik.bme.hu>
The bitbang i2c implementation is also useful for other device models
such as DDC in display controllers. Move the header to include/hw/i2c/
to allow it to be used from other device models and adjust users of
this include. This also reverts commit 2b4c1125ac which is no longer
needed.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/i2c/bitbang_i2c.c | 2 +-
hw/i2c/ppc4xx_i2c.c | 1 -
hw/i2c/versatile_i2c.c | 2 +-
{hw => include/hw}/i2c/bitbang_i2c.h | 2 ++
include/hw/i2c/i2c.h | 2 --
include/hw/i2c/ppc4xx_i2c.h | 2 +-
6 files changed, 5 insertions(+), 6 deletions(-)
rename {hw => include/hw}/i2c/bitbang_i2c.h (80%)
diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index 5dfc72d9d7..3cb0509b02 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -12,7 +12,7 @@
#include "qemu/osdep.h"
#include "hw/hw.h"
-#include "bitbang_i2c.h"
+#include "hw/i2c/bitbang_i2c.h"
#include "hw/sysbus.h"
#include "qemu/module.h"
diff --git a/hw/i2c/ppc4xx_i2c.c b/hw/i2c/ppc4xx_i2c.c
index d606d3dbeb..5fb4f86c38 100644
--- a/hw/i2c/ppc4xx_i2c.c
+++ b/hw/i2c/ppc4xx_i2c.c
@@ -30,7 +30,6 @@
#include "cpu.h"
#include "hw/hw.h"
#include "hw/i2c/ppc4xx_i2c.h"
-#include "bitbang_i2c.h"
#define PPC4xx_I2C_MEM_SIZE 18
diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c
index e07be9890c..24b6e36b6d 100644
--- a/hw/i2c/versatile_i2c.c
+++ b/hw/i2c/versatile_i2c.c
@@ -23,7 +23,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
-#include "bitbang_i2c.h"
+#include "hw/i2c/bitbang_i2c.h"
#include "qemu/log.h"
#include "qemu/module.h"
diff --git a/hw/i2c/bitbang_i2c.h b/include/hw/i2c/bitbang_i2c.h
similarity index 80%
rename from hw/i2c/bitbang_i2c.h
rename to include/hw/i2c/bitbang_i2c.h
index 9443021710..3a7126d5de 100644
--- a/hw/i2c/bitbang_i2c.h
+++ b/include/hw/i2c/bitbang_i2c.h
@@ -3,6 +3,8 @@
#include "hw/i2c/i2c.h"
+typedef struct bitbang_i2c_interface bitbang_i2c_interface;
+
#define BITBANG_I2C_SDA 0
#define BITBANG_I2C_SCL 1
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
index 8e236f7bb4..75c5bd638b 100644
--- a/include/hw/i2c/i2c.h
+++ b/include/hw/i2c/i2c.h
@@ -81,8 +81,6 @@ uint8_t i2c_recv(I2CBus *bus);
DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr);
-typedef struct bitbang_i2c_interface bitbang_i2c_interface;
-
/* lm832x.c */
void lm832x_key_event(DeviceState *dev, int key, int state);
diff --git a/include/hw/i2c/ppc4xx_i2c.h b/include/hw/i2c/ppc4xx_i2c.h
index aa2a2bf9de..8437bf070b 100644
--- a/include/hw/i2c/ppc4xx_i2c.h
+++ b/include/hw/i2c/ppc4xx_i2c.h
@@ -28,7 +28,7 @@
#define PPC4XX_I2C_H
#include "hw/sysbus.h"
-#include "hw/i2c/i2c.h"
+#include "hw/i2c/bitbang_i2c.h"
#define TYPE_PPC4xx_I2C "ppc4xx-i2c"
#define PPC4xx_I2C(obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C)
--
2.13.7
^ permalink raw reply related
* Re: [PATCH] can: xilinx_can: clean up indentation issue
From: Michal Simek @ 2019-06-20 11:55 UTC (permalink / raw)
To: Colin King, Wolfgang Grandegger, Marc Kleine-Budde,
David S . Miller, Michal Simek, linux-can, netdev,
linux-arm-kernel
Cc: kernel-janitors, linux-kernel
In-Reply-To: <20190619164518.5683-1-colin.king@canonical.com>
On 19. 06. 19 18:45, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> A statement is indented one level too deep, fix this.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/net/can/xilinx_can.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
> index 63203ff452b5..a3940141555c 100644
> --- a/drivers/net/can/xilinx_can.c
> +++ b/drivers/net/can/xilinx_can.c
> @@ -924,7 +924,7 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
> cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
> }
> }
> - priv->can.can_stats.bus_error++;
> + priv->can.can_stats.bus_error++;
> }
>
> if (skb) {
>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Thanks,
Michal
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.